mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 00:32:55 +08:00
CB-8699 Fix CordovaResourceApi copyResource creating zero-length files when src=uncompressed asset
This commit is contained in:
parent
56d61eb44f
commit
f6e56b345d
@ -336,7 +336,10 @@ public class CordovaResourceApi {
|
|||||||
if (input.assetFd != null) {
|
if (input.assetFd != null) {
|
||||||
offset = input.assetFd.getStartOffset();
|
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 {
|
} else {
|
||||||
final int BUFFER_SIZE = 8192;
|
final int BUFFER_SIZE = 8192;
|
||||||
byte[] buffer = new byte[BUFFER_SIZE];
|
byte[] buffer = new byte[BUFFER_SIZE];
|
||||||
|
Loading…
Reference in New Issue
Block a user