Skip to content

Commit

Permalink
fix: null bytes appended on files with no misaligns (closes #11)
Browse files Browse the repository at this point in the history
Credits to @deroko
  • Loading branch information
iyxan23 committed May 17, 2024
1 parent 7af19d8 commit bf8a8cf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/com/iyxan23/zipalignjava/ZipAlign.java
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,10 @@ public static void alignZip(RandomAccessFile file, OutputStream out, int alignme
if (neededAlignments.size() == 0) {
// there is no needed alignment, stream it all!
byte[] buffer = new byte[8192];
while (file.read(buffer) != -1) out.write(buffer);
int len;
while (-1 != (len = file.read(buffer))){
out.write(buffer, 0, len);
}
return;
}

Expand Down

0 comments on commit bf8a8cf

Please sign in to comment.