I've created a stream from client to server. How to create ProgressMonitorInputStream
or something else in this kind, for this piece of code?
FileInputStream fileStream = new FileInputStream(file);
int ch;
do
{
ch = fileStream.read();
exitStream.writeUTF(String.valueOf(ch));
}
while(ch != -1);
fileStream.close();
Updated code - the window appear, but it's empty. Only a frame. How to fix it?
String fileName = "aaa.jpg";
File fileToBeSend = new File(fileName);
InputStream input = new ProgressMonitorInputStream(
null,
"Reading: " + fileName,
new FileInputStream(fileToBeSend));
int ch;
do
{
ch = input.read();
exitStream.writeUTF(String.valueOf(ch));
} while(ch != -1);
input.close();