(String filepath, String base64Content, int position, Promise promise)
| 186 | } |
| 187 | |
| 188 | @ReactMethod |
| 189 | public void write(String filepath, String base64Content, int position, Promise promise) { |
| 190 | try { |
| 191 | byte[] bytes = Base64.decode(base64Content, Base64.DEFAULT); |
| 192 | |
| 193 | if (position < 0) { |
| 194 | OutputStream outputStream = getOutputStream(filepath, true); |
| 195 | outputStream.write(bytes); |
| 196 | outputStream.close(); |
| 197 | } else { |
| 198 | RandomAccessFile file = new RandomAccessFile(filepath, "rw"); |
| 199 | file.seek(position); |
| 200 | file.write(bytes); |
| 201 | file.close(); |
| 202 | } |
| 203 | |
| 204 | promise.resolve(null); |
| 205 | } catch (Exception ex) { |
| 206 | ex.printStackTrace(); |
| 207 | reject(promise, filepath, ex); |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | @ReactMethod |
| 212 | public void exists(String filepath, Promise promise) { |
no test coverage detected