There are many posts on JProgressBar
, but I can not find a solution for the following problem. How do I update JProgressBar
measuring bytes received from InputStream
?
For example, I have the following code:
int bytesRead;
byte buffer = new byte[1024];
ByteArrayOutputStream getBytes = new ByteArrayOutputStream();
while ((bytesRead = dis.read(buffer)) != -1) {
getBytes.write(buffer, 0, bytesRead);
}
return(getBytes.toByteArray());