Changeset 846
- Timestamp:
- 02/05/14 16:08:38 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/network/ImageSaver.java
r843 r846 27 27 FileOutputStream out = new FileOutputStream(file); 28 28 // file is the remaining bytes of the stream 29 byte[] buf = null; 30 if(fileLen > 1024) { 31 buf = new byte[1024]; 32 while(fileLen > 1024) { 33 is.read(buf); 34 out.write(buf); 35 fileLen -= 1024; 29 byte[] buf = new byte[1024]; 30 int r = -1; 31 int len = 0; 32 while((r = is.read(buf)) > 0) { 33 out.write(buf, 0, r); 34 len += r; 35 if(fileLen - len <= 0) { 36 break; 37 } 38 if(fileLen - len < 1024) { 39 buf = new byte[fileLen - len]; 36 40 } 37 41 } 38 buf = new byte[fileLen];39 is.read(buf);40 out.write(buf);41 42 out.flush(); 42 43 out.close();
Note:
See TracChangeset
for help on using the changeset viewer.