File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
library/src/main/java/com/qiniu/android/collect Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 44import com .qiniu .android .storage .UpToken ;
55import com .qiniu .android .utils .GZipUtil ;
66
7+ import java .io .ByteArrayOutputStream ;
78import java .io .File ;
89import java .io .FileNotFoundException ;
910import java .io .FileOutputStream ;
@@ -286,13 +287,17 @@ private byte[] getLogData(File recordFile){
286287 return null ;
287288 }
288289
289- long length = recordFile .length ();
290290 RandomAccessFile randomAccessFile = null ;
291291 byte [] data = null ;
292292 try {
293293 randomAccessFile = new RandomAccessFile (recordFile , "r" );
294- data = new byte [(int )length ];
295- randomAccessFile .read (data );
294+ ByteArrayOutputStream out = new ByteArrayOutputStream ();
295+ int len = 0 ;
296+ byte [] buff = new byte [3096 ];
297+ while ((len = randomAccessFile .read (buff )) >= 0 ){
298+ out .write (buff , 0 , len );
299+ }
300+ data = out .toByteArray ();
296301 } catch (FileNotFoundException ignored ) {
297302 } catch (IOException e ) {
298303 data = null ;
You can’t perform that action at this time.
0 commit comments