|
@@ -249,8 +249,9 @@ public class RNFetchBlobFS {
|
249
|
249
|
while ((cursor = fs.read(buffer)) != -1) {
|
250
|
250
|
encoder.encode(ByteBuffer.wrap(buffer).asCharBuffer());
|
251
|
251
|
String chunk = new String(buffer);
|
252
|
|
- if(cursor != bufferSize)
|
|
252
|
+ if(cursor != bufferSize) {
|
253
|
253
|
chunk = chunk.substring(0, cursor);
|
|
254
|
+ }
|
254
|
255
|
emitStreamEvent(streamId, "data", chunk);
|
255
|
256
|
if(tick > 0)
|
256
|
257
|
SystemClock.sleep(tick);
|
|
@@ -292,7 +293,8 @@ public class RNFetchBlobFS {
|
292
|
293
|
buffer = null;
|
293
|
294
|
|
294
|
295
|
} catch (Exception err) {
|
295
|
|
- emitStreamEvent(streamId, "error", "Failed to convert data to "+encoding+" encoded string, this might due to the source data is not able to convert using this encoding.");
|
|
296
|
+ emitStreamEvent(streamId, "warn", "Failed to convert data to "+encoding+" encoded string, this might due to the source data is not able to convert using this encoding.");
|
|
297
|
+ err.printStackTrace();
|
296
|
298
|
}
|
297
|
299
|
}
|
298
|
300
|
|