Author: bodewig Date: Sat Jul 30 15:15:31 2011 New Revision: 1152488 URL: http://svn.apache.org/viewvc?rev=1152488&view=rev Log: whitespace only
Modified:
commons/proper/compress/branches/zip64/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
commons/proper/compress/branches/zip64/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportTest.java
Modified:
commons/proper/compress/branches/zip64/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
URL:
http://svn.apache.org/viewvc/commons/proper/compress/branches/zip64/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java?rev=1152488&r1=1152487&r2=1152488&view=diff
==============================================================================
---
commons/proper/compress/branches/zip64/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
(original)
+++
commons/proper/compress/branches/zip64/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
Sat Jul 30 15:15:31 2011
@@ -445,8 +445,8 @@ public class ZipArchiveOutputStream exte
raf.seek(localDataStart);
writeOut(ZipLong.getBytes(entry.getCrc()));
if (!hasZip64Extra(entry)) {
- writeOut(ZipLong.getBytes(entry.getCompressedSize()));
- writeOut(ZipLong.getBytes(entry.getSize()));
+ writeOut(ZipLong.getBytes(entry.getCompressedSize()));
+ writeOut(ZipLong.getBytes(entry.getSize()));
} else {
writeOut(ZipLong.ZIP64_MAGIC.getBytes());
writeOut(ZipLong.ZIP64_MAGIC.getBytes());
@@ -1157,7 +1157,7 @@ public class ZipArchiveOutputStream exte
}
// even if the field is there already, make sure it is the first one
- ze.addAsFirstExtraField(z64);
+ ze.addAsFirstExtraField(z64);
return z64;
}
Modified:
commons/proper/compress/branches/zip64/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/compress/branches/zip64/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportTest.java?rev=1152488&r1=1152487&r2=1152488&view=diff
==============================================================================
---
commons/proper/compress/branches/zip64/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportTest.java
(original)
+++
commons/proper/compress/branches/zip64/src/test/java/org/apache/commons/compress/archivers/zip/Zip64SupportTest.java
Sat Jul 30 15:15:31 2011
@@ -310,149 +310,136 @@ public class Zip64SupportTest {
*/
private static ZipOutputTest writeBigStoredEntry(final boolean knownSize) {
return new ZipOutputTest() {
- public void test(File f,
- ZipArchiveOutputStream zos)
- throws IOException {
- byte[] buf = new byte[1000 * 1000];
- ZipArchiveEntry zae =
- new ZipArchiveEntry("0");
- if (knownSize) {
- zae.setSize(FIVE_BILLION);
- zae.setCrc(0x5c316f50L);
- }
- zae.setMethod(ZipArchiveEntry.STORED);
- zos.putArchiveEntry(zae);
- for (int j = 0;
- j < FIVE_BILLION / 1000 / 1000;
- j++) {
- zos.write(buf);
- }
- zos.closeArchiveEntry();
- zos.close();
-
- RandomAccessFile a =
- new RandomAccessFile(f, "r");
- try {
- final long end =
-
getLengthAndPositionAtCentralDirectory(a);
-
- // grab first entry, verify
- // sizes are 0xFFFFFFFF and
- // it has a ZIP64 extended
- // information extra field
- byte[] header = new byte[12];
- a.readFully(header);
- assertArrayEquals(new byte[] {
- // sig
- (byte) 0x50, (byte) 0x4b, 1,
2,
- // version made by
- 45, 0,
- // version needed to extract
- 45, 0,
- // GPB (EFS bit)
- 0, 8,
- // method
- 0, 0
- }, header);
- // ignore timestamp
- a.skipBytes(4);
- byte[] rest = new byte[31];
- a.readFully(rest);
- assertArrayEquals(new byte[] {
- // CRC
- (byte) 0x50, (byte) 0x6F,
- (byte) 0x31, (byte) 0x5c,
- // Compressed Size
- (byte) 0xFF, (byte) 0xFF,
- (byte) 0xFF, (byte) 0xFF,
- // Original Size
- (byte) 0xFF, (byte) 0xFF,
- (byte) 0xFF, (byte) 0xFF,
- // file name length
- 1, 0,
- // extra field length
- 20, 0,
- // comment length
- 0, 0,
- // disk number
- 0, 0,
- // attributes
- 0, 0,
- 0, 0, 0, 0,
- // offset
- 0, 0, 0, 0,
- // file name
- (byte) '0'
- }, rest);
- byte[] extra = new byte[20];
- a.readFully(extra);
- // 5e9 == 0x12A05F200
- assertArrayEquals(new byte[] {
- // Header-ID
- 1, 0,
- // size of extra
- 16, 0,
- // original size
- 0, (byte) 0xF2, 5, (byte)
0x2A,
- 1, 0, 0, 0,
- // compressed size
- 0, (byte) 0xF2, 5, (byte)
0x2A,
- 1, 0, 0, 0,
- }, extra);
+ public void test(File f, ZipArchiveOutputStream zos)
+ throws IOException {
+ byte[] buf = new byte[1000 * 1000];
+ ZipArchiveEntry zae = new ZipArchiveEntry("0");
+ if (knownSize) {
+ zae.setSize(FIVE_BILLION);
+ zae.setCrc(0x5c316f50L);
+ }
+ zae.setMethod(ZipArchiveEntry.STORED);
+ zos.putArchiveEntry(zae);
+ for (int j = 0; j < FIVE_BILLION / 1000 / 1000; j++) {
+ zos.write(buf);
+ }
+ zos.closeArchiveEntry();
+ zos.close();
- // and now validate local file header
- a.seek(0);
- header = new byte[10];
- a.readFully(header);
- assertArrayEquals(new byte[] {
- // sig
- (byte) 0x50, (byte) 0x4b, 3,
4,
- // version needed to extract
- 45, 0,
- // GPB (EFS bit)
- 0, 8,
- // method
- 0, 0
- }, header);
- // ignore timestamp
- a.skipBytes(4);
- rest = new byte[17];
- a.readFully(rest);
- assertArrayEquals(new byte[] {
- // CRC
- (byte) 0x50, (byte) 0x6F,
- (byte) 0x31, (byte) 0x5c,
- // Compressed Size
- (byte) 0xFF, (byte) 0xFF,
- (byte) 0xFF, (byte) 0xFF,
- // Original Size
- (byte) 0xFF, (byte) 0xFF,
- (byte) 0xFF, (byte) 0xFF,
- // file name length
- 1, 0,
- // extra field length
- 20, 0,
- // file name
- (byte) '0'
- }, rest);
- a.readFully(extra);
- // 5e9 == 0x12A05F200
- assertArrayEquals(new byte[] {
- // Header-ID
- 1, 0,
- // size of extra
- 16, 0,
- // original size
- 0, (byte) 0xF2, 5, (byte)
0x2A,
- 1, 0, 0, 0,
- // compressed size
- 0, (byte) 0xF2, 5, (byte)
0x2A,
- 1, 0, 0, 0,
- }, extra);
- } finally {
- a.close();
- }
- }
+ RandomAccessFile a = new RandomAccessFile(f, "r");
+ try {
+ final long end = getLengthAndPositionAtCentralDirectory(a);
+
+ // grab first entry, verify sizes are 0xFFFFFFFF
+ // and it has a ZIP64 extended information extra
+ // field
+ byte[] header = new byte[12];
+ a.readFully(header);
+ assertArrayEquals(new byte[] {
+ // sig
+ (byte) 0x50, (byte) 0x4b, 1, 2,
+ // version made by
+ 45, 0,
+ // version needed to extract
+ 45, 0,
+ // GPB (EFS bit)
+ 0, 8,
+ // method
+ 0, 0
+ }, header);
+ // ignore timestamp
+ a.skipBytes(4);
+ byte[] rest = new byte[31];
+ a.readFully(rest);
+ assertArrayEquals(new byte[] {
+ // CRC
+ (byte) 0x50, (byte) 0x6F, (byte) 0x31, (byte) 0x5c,
+ // Compressed Size
+ (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+ // Original Size
+ (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+ // file name length
+ 1, 0,
+ // extra field length
+ 20, 0,
+ // comment length
+ 0, 0,
+ // disk number
+ 0, 0,
+ // attributes
+ 0, 0,
+ 0, 0, 0, 0,
+ // offset
+ 0, 0, 0, 0,
+ // file name
+ (byte) '0'
+ }, rest);
+ byte[] extra = new byte[20];
+ a.readFully(extra);
+ // 5e9 == 0x12A05F200
+ assertArrayEquals(new byte[] {
+ // Header-ID
+ 1, 0,
+ // size of extra
+ 16, 0,
+ // original size
+ 0, (byte) 0xF2, 5, (byte) 0x2A,
+ 1, 0, 0, 0,
+ // compressed size
+ 0, (byte) 0xF2, 5, (byte) 0x2A,
+ 1, 0, 0, 0,
+ }, extra);
+
+ // and now validate local file header
+ a.seek(0);
+ header = new byte[10];
+ a.readFully(header);
+ assertArrayEquals(new byte[] {
+ // sig
+ (byte) 0x50, (byte) 0x4b, 3, 4,
+ // version needed to extract
+ 45, 0,
+ // GPB (EFS bit)
+ 0, 8,
+ // method
+ 0, 0
+ }, header);
+ // ignore timestamp
+ a.skipBytes(4);
+ rest = new byte[17];
+ a.readFully(rest);
+ assertArrayEquals(new byte[] {
+ // CRC
+ (byte) 0x50, (byte) 0x6F, (byte) 0x31, (byte) 0x5c,
+ // Compressed Size
+ (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+ // Original Size
+ (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+ // file name length
+ 1, 0,
+ // extra field length
+ 20, 0,
+ // file name
+ (byte) '0'
+ }, rest);
+ a.readFully(extra);
+ // 5e9 == 0x12A05F200
+ assertArrayEquals(new byte[] {
+ // Header-ID
+ 1, 0,
+ // size of extra
+ 16, 0,
+ // original size
+ 0, (byte) 0xF2, 5, (byte) 0x2A,
+ 1, 0, 0, 0,
+ // compressed size
+ 0, (byte) 0xF2, 5, (byte) 0x2A,
+ 1, 0, 0, 0,
+ }, extra);
+ } finally {
+ a.close();
+ }
+ }
};
}
