26
26
import ru .olegcherednik .zip4jvm .model .builders .LocalFileHeaderBuilder ;
27
27
import ru .olegcherednik .zip4jvm .model .entry .ZipEntry ;
28
28
29
- import org .apache .commons .codec .digest .PureJavaCrc32 ;
30
-
31
29
import java .io .IOException ;
32
30
import java .io .OutputStream ;
33
- import java .util .zip .CRC32 ;
34
- import java .util .zip .Checksum ;
35
31
36
32
import static ru .olegcherednik .zip4jvm .model .ZipModel .MAX_ENTRY_SIZE ;
37
33
import static ru .olegcherednik .zip4jvm .model .ZipModel .MAX_LOCAL_FILE_HEADER_OFFS ;
@@ -52,9 +48,9 @@ public final class EntryMetadataOutputStream extends OutputStream {
52
48
53
49
private final ZipEntry zipEntry ;
54
50
private final DataOutput out ;
55
- private final Checksum checksum = new PureJavaCrc32 ();
51
+ // private final Checksum checksum = new PureJavaCrc32();
56
52
57
- private long uncompressedSize ;
53
+ // private long uncompressedSize;
58
54
59
55
public EntryMetadataOutputStream (ZipEntry zipEntry , DataOutput out ) {
60
56
this .zipEntry = zipEntry ;
@@ -70,20 +66,20 @@ public void writeLocalFileHeader() throws IOException {
70
66
71
67
@ Override
72
68
public void write (int b ) throws IOException {
73
- checksum .update (b );
74
- uncompressedSize ++;
69
+ // checksum.update(b);
70
+ // uncompressedSize++;
75
71
}
76
72
77
73
@ Override
78
74
public void write (byte [] buf , int offs , int len ) throws IOException {
79
- checksum .update (buf , offs , len );
80
- uncompressedSize += Math .max (0 , len );
75
+ // checksum.update(buf, offs, len);
76
+ // uncompressedSize += Math.max(0, len);
81
77
}
82
78
83
79
@ Override
84
80
public void close () throws IOException {
85
- zipEntry .setChecksum (checksum .getValue ());
86
- zipEntry .setUncompressedSize (uncompressedSize );
81
+ // zipEntry.setChecksum(checksum.getValue());
82
+ // zipEntry.setUncompressedSize(uncompressedSize);
87
83
zipEntry .setCompressedSize (out .getWrittenBytesAmount (COMPRESSED_DATA ));
88
84
updateZip64 ();
89
85
writeDataDescriptor ();
@@ -104,7 +100,7 @@ private void writeDataDescriptor() throws IOException {
104
100
if (!zipEntry .isDataDescriptorAvailable ())
105
101
return ;
106
102
107
- DataDescriptor dataDescriptor = new DataDescriptor (checksum . getValue (),
103
+ DataDescriptor dataDescriptor = new DataDescriptor (zipEntry . getChecksum (),
108
104
zipEntry .getCompressedSize (),
109
105
zipEntry .getUncompressedSize ());
110
106
DataDescriptorWriter .get (zipEntry .isZip64 (), dataDescriptor ).write (out );
0 commit comments