MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / copy

Method copy

src/plugins/sdcard/src/android/SDcard.java:819–846  ·  view source on GitHub ↗
(String src, String dest, final CallbackContext callback)

Source from the content-addressed store, hash-verified

817 }
818
819 private void copy(String src, String dest, final CallbackContext callback) {
820 final String splittedStr[] = src.split(SEPARATOR, 2);
821 final String srcUri = splittedStr[0];
822 final String srcId = splittedStr[1];
823 final String destId = dest.split(SEPARATOR, 2)[1];
824
825 cordova
826 .getThreadPool()
827 .execute(
828 new Runnable() {
829 @Override
830 public void run() {
831 try {
832 Uri newUri = copy(srcUri, srcId, destId);
833 if (newUri == null) {
834 callback.error("Unable to copy " + src);
835 } else {
836 callback.success(
837 srcUri + SEPARATOR + DocumentsContract.getDocumentId(newUri)
838 );
839 }
840 } catch (Exception e) {
841 callback.error(e.toString());
842 }
843 }
844 }
845 );
846 }
847
848 private Uri copy(String root, String srcId, String destId)
849 throws IOException, FileNotFoundException {

Callers 2

executeMethod · 0.95
runMethod · 0.95

Calls 8

getUriMethod · 0.95
getFileMethod · 0.95
copyFileMethod · 0.95
createDocumentMethod · 0.80
deleteDocumentMethod · 0.80
closeMethod · 0.65
executeMethod · 0.45
getStringMethod · 0.45

Tested by

no test coverage detected