File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
android/src/main/java/com/ReactNativeBlobUtil Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -69,16 +69,20 @@ else if (resolved == null) {
6969 int cursor = 0 ;
7070 boolean error = false ;
7171
72+
73+
7274 if (encoding .equalsIgnoreCase ("utf8" )) {
7375 InputStreamReader isr = new InputStreamReader (fs , Charset .forName ("UTF-8" ));
7476 BufferedReader reader = new BufferedReader (isr , chunkSize );
7577 char [] buffer = new char [chunkSize ];
7678 // read chunks of the string
77- while (reader .read (buffer , 0 , chunkSize ) != -1 ) {
78- String chunk = new String (buffer );
79+ int numBytesRead = reader .read (buffer , 0 , chunkSize );
80+ while (numBytesRead != -1 ) {
81+ String chunk = new String (buffer , 0 , numBytesRead );
7982 emitStreamEvent (streamId , "data" , chunk );
8083 if (tick > 0 )
8184 SystemClock .sleep (tick );
85+ numBytesRead = reader .read (buffer , 0 , chunkSize );
8286 }
8387
8488 reader .close ();
You can’t perform that action at this time.
0 commit comments