Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions android/src/main/java/com/rnfs2/RNFSManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -362,45 +362,6 @@ public void readDir(String directory, Promise promise) {
}
}

/**
* Internal method for copying that works with any InputStream
*
* @param in InputStream from assets or file
* @param source source path (only used for logging errors)
* @param destination destination path
* @param promise React Callback
*/
private void copyInputStream(InputStream in, String source, String destination, Promise promise) {
OutputStream out = null;
try {
out = getOutputStream(destination, false);

byte[] buffer = new byte[1024 * 10]; // 10k buffer
int read;
while ((read = in.read(buffer)) != -1) {
out.write(buffer, 0, read);
}

// Success!
promise.resolve(null);
} catch (Exception ex) {
reject(promise, source, new Exception(String.format("Failed to copy '%s' to %s (%s)", source, destination, ex.getLocalizedMessage())));
} finally {
if (in != null) {
try {
in.close();
} catch (IOException ignored) {
}
}
if (out != null) {
try {
out.close();
} catch (IOException ignored) {
}
}
}
}

@ReactMethod
public void stat(String filepath, Promise promise) {
try {
Expand Down