diff --git a/apkx/src/java/me/petcu/defoldapkx/DefoldInterface.java b/apkx/src/java/me/petcu/defoldapkx/DefoldInterface.java index cd7cbaa..defe874 100644 --- a/apkx/src/java/me/petcu/defoldapkx/DefoldInterface.java +++ b/apkx/src/java/me/petcu/defoldapkx/DefoldInterface.java @@ -196,9 +196,13 @@ public static final byte[] zipGetFile(ZipResourceFile zip, String path) throws I int uncompressedLength = (int)zip.getUncompressedLength(path); byte[] bytes = new byte[uncompressedLength]; - long readBytes = stream.read(bytes, 0, uncompressedLength); - if (readBytes < uncompressedLength) { - return null; + int index = 0; + while (index < uncompressedLength) { + int readBytes = stream.read(bytes, index, uncompressedLength - index); + if (readBytes < 0) { + return null; // Unexpected EOF + } + index += readBytes; } return bytes;