diff --git a/framework/src/org/apache/cordova/CordovaResourceApi.java b/framework/src/org/apache/cordova/CordovaResourceApi.java index 9c2e7080..47f936e8 100644 --- a/framework/src/org/apache/cordova/CordovaResourceApi.java +++ b/framework/src/org/apache/cordova/CordovaResourceApi.java @@ -336,7 +336,10 @@ public class CordovaResourceApi { if (input.assetFd != null) { offset = input.assetFd.getStartOffset(); } - outChannel.transferFrom(inChannel, offset, length); + // transferFrom()'s 2nd arg is a relative position. Need to set the absolute + // position first. + inChannel.position(offset); + outChannel.transferFrom(inChannel, 0, length); } else { final int BUFFER_SIZE = 8192; byte[] buffer = new byte[BUFFER_SIZE];