(String filepath, int length, int position, Promise promise)
| 234 | } |
| 235 | |
| 236 | @ReactMethod |
| 237 | public void read(String filepath, int length, int position, Promise promise) { |
| 238 | try { |
| 239 | InputStream inputStream = getInputStream(filepath); |
| 240 | byte[] buffer = new byte[length]; |
| 241 | inputStream.skip(position); |
| 242 | int bytesRead = inputStream.read(buffer, 0, length); |
| 243 | |
| 244 | String base64Content = Base64.encodeToString(buffer, 0, bytesRead, Base64.NO_WRAP); |
| 245 | |
| 246 | promise.resolve(base64Content); |
| 247 | } catch (Exception ex) { |
| 248 | ex.printStackTrace(); |
| 249 | reject(promise, filepath, ex); |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | @ReactMethod |
| 254 | public void readFileAssets(String filepath, Promise promise) { |
no test coverage detected