Win a copy of Spring Boot in Practice this week in the Spring forum!

Jon House

Greenhorn
+ Follow
since Jan 27, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jon House

Try adding the bout.flush to the portion of the code when there's less than 1024 bytes. See code below. I was having the same problem until I used the bout.flush(); to flush the buffer.

System.out.println("No of Bytes in file" + bReader.available());
byte[] buffer = new byte[bReader.available()];
int lastReadCount = bReader.read(buffer);
bout.write(buffer,0,lastReadCount);
total = total + lastReadCount;
bout.flush();
System.out.println(total);