equal
deleted
inserted
replaced
1 "{ Encoding: utf8 }" |
|
2 |
|
3 " |
1 " |
4 COPYRIGHT (c) 2002 by eXept Software AG |
2 COPYRIGHT (c) 2002 by eXept Software AG |
5 All Rights Reserved |
3 All Rights Reserved |
6 |
4 |
7 This software is furnished under a license and may be used |
5 This software is furnished under a license and may be used |
18 CompressionStream subclass:#ZipStream |
16 CompressionStream subclass:#ZipStream |
19 instanceVariableNames:'' |
17 instanceVariableNames:'' |
20 classVariableNames:'Z_DEFLATED HEAD_OS_CODE HEAD_RESERVED HEAD_EXTRA_FIELD |
18 classVariableNames:'Z_DEFLATED HEAD_OS_CODE HEAD_RESERVED HEAD_EXTRA_FIELD |
21 HEAD_ORIG_NAME HEAD_COMMENT HEAD_CRC GZ_MAGIC_ID' |
19 HEAD_ORIG_NAME HEAD_COMMENT HEAD_CRC GZ_MAGIC_ID' |
22 poolDictionaries:'' |
20 poolDictionaries:'' |
23 category:'System-Compress' |
21 category:'Streams-Compressed' |
24 ! |
22 ! |
25 |
23 |
26 !ZipStream primitiveDefinitions! |
24 !ZipStream primitiveDefinitions! |
27 %{ |
25 %{ |
28 |
26 |
71 " |
69 " |
72 ! |
70 ! |
73 |
71 |
74 documentation |
72 documentation |
75 " |
73 " |
76 Zip compression and decompression (used in gzip and zip) |
74 Zip compression and decompression (as used in gzip and zip) |
77 |
75 |
78 [author:] |
76 [author:] |
79 Claus Atzkern |
77 Claus Atzkern |
80 |
78 |
81 [instance variables:] |
79 [instance variables:] |
82 |
80 |
83 [class variables:] |
81 [class variables:] |
84 |
82 |
226 ! ! |
224 ! ! |
227 |
225 |
228 !ZipStream class methodsFor:'ZipInterface compatibility - compress/uncompress'! |
226 !ZipStream class methodsFor:'ZipInterface compatibility - compress/uncompress'! |
229 |
227 |
230 compress: aUncompressedByteArray into: aCompressedByteArray |
228 compress: aUncompressedByteArray into: aCompressedByteArray |
231 ^ self flatBytesIn: aUncompressedByteArray |
229 ^ self |
232 from: 1 |
230 flatBytesIn: aUncompressedByteArray |
233 to: (aUncompressedByteArray size) |
231 from: 1 to: (aUncompressedByteArray size) |
234 into: aCompressedByteArray |
232 into: aCompressedByteArray |
235 doCompress: true. |
233 doCompress: true. |
236 ! |
234 ! |
237 |
235 |
238 flatBytesIn:bytesIn from:start to:stop into:bytesOut doCompress:doCompress |
236 flatBytesIn:bytesIn from:start to:stop into:bytesOut doCompress:doCompress |
239 "compress or uncompress the bytesIn buffer into the bytesOut buffer; returns |
237 "compress or uncompress the bytesIn buffer into the bytesOut buffer; returns |
240 the un/compressed size; on error an exception is raised" |
238 the un/compressed size; on error an exception is raised" |
293 errorNr == -5 ifTrue:[ ^ self error:'not enough memory in the output stream' ]. |
291 errorNr == -5 ifTrue:[ ^ self error:'not enough memory in the output stream' ]. |
294 |
292 |
295 self error:('compressing error: ', errorNr printString). |
293 self error:('compressing error: ', errorNr printString). |
296 ! |
294 ! |
297 |
295 |
298 uncompress: aCompressedByteArray into: aUncompressedByteArray |
296 uncompress: aCompressedByteArray into: anUncompressedByteArray |
299 ^ self flatBytesIn: aCompressedByteArray |
297 ^ self |
300 from: 1 |
298 flatBytesIn: aCompressedByteArray |
301 to: (aCompressedByteArray size) |
299 from: 1 to: (aCompressedByteArray size) |
302 into: aUncompressedByteArray |
300 into: anUncompressedByteArray |
303 doCompress: false. |
301 doCompress: false. |
304 ! ! |
302 ! ! |
305 |
303 |
306 !ZipStream class methodsFor:'ZipInterface compatibility - crc'! |
304 !ZipStream class methodsFor:'ZipInterface compatibility - crc'! |
307 |
305 |
308 crc32Add:aCharacterOrByte crc:crc |
306 crc32Add:aCharacterOrByte crc:crc |