|
|
|
|
21
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
21
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
22
|
|
22
|
|
23
|
import java.io.*;
|
23
|
import java.io.*;
|
24
|
-import java.nio.ByteBuffer;
|
|
|
25
|
import java.nio.charset.Charset;
|
24
|
import java.nio.charset.Charset;
|
26
|
-import java.nio.charset.CharsetEncoder;
|
|
|
27
|
import java.security.MessageDigest;
|
25
|
import java.security.MessageDigest;
|
28
|
import java.util.ArrayList;
|
26
|
import java.util.ArrayList;
|
29
|
import java.util.HashMap;
|
27
|
import java.util.HashMap;
|
|
|
|
|
325
|
boolean error = false;
|
323
|
boolean error = false;
|
326
|
|
324
|
|
327
|
if (encoding.equalsIgnoreCase("utf8")) {
|
325
|
if (encoding.equalsIgnoreCase("utf8")) {
|
328
|
- CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder();
|
|
|
329
|
while ((cursor = fs.read(buffer)) != -1) {
|
326
|
while ((cursor = fs.read(buffer)) != -1) {
|
330
|
- encoder.encode(ByteBuffer.wrap(buffer).asCharBuffer());
|
|
|
331
|
String chunk = new String(buffer, 0, cursor);
|
327
|
String chunk = new String(buffer, 0, cursor);
|
332
|
emitStreamEvent(streamId, "data", chunk);
|
328
|
emitStreamEvent(streamId, "data", chunk);
|
333
|
if(tick > 0)
|
329
|
if(tick > 0)
|