From VisualWorks®, 7.6 of February 1, 2008 on February 1, 2008 at 12:29:17 pm (Dialog confirm: 'You are filing-in a Parcel source file!\\While this is possible it will not have\the same effect as loading the parcel.\None of the Parcel''s prerequisites will\be loaded and none of its load actions\will be performed.\\Are you sure you want to file-in?' withCRs) ifFalse: [self error: 'Parcel file-in abandoned. Choose terminate or close.'] <name>Zip</name> <environment>OS</environment> <private>false</private> <imports> Core.* External.* OS.* </imports> <category>Net-Namespace</category> <attributes> <package>Compression-Zip</package> </attributes> <class> <name>LimitedReadStream</name> <environment>OS.ZLib</environment> <super>Core.Stream</super> <private>false</private> none stream readLimit <imports></imports> <category>Compression-Zip</category> <attributes> <package>Compression-Zip</package> </attributes> </class> <comment> OS.ZLib.LimitedReadStream
Allows to read only up to a specified <limit> from an underlying stream. The limit is specified in terms of position in the underlying stream, e.g. if limit is 10 that means this stream will refuse to read past position 10 in the underlying stream. (self on: 'Hello' readStream limit: 4) upToEnd (self on: 'Hello' readStream limit: 4) nextAvailable: 10 [ (self on: 'Hello' readStream limit: 4) next: 10 ] on: IncompleteNextCountError do: [ :ex | ex parameter ] (self on: ('Hello' readStream skip: 3; yourself) limit: 2) atEnd Instance Variables: stream <Stream> the underlying stream readLimit <Integer> maximum number of elements to read
</comment> <class> <name>Archive</name> <environment>OS.Zip</environment> <super>Core.Object</super> <private>false</private> none stream directory entries comment <imports></imports> <category>Zlib Interface</category> <attributes> <package>Compression-Zip</package> </attributes> </class> <comment> OS.Zip.Archive
Represents a single ZIP archive (e.g. a .zip file), providing access to global archive attributes and all archive entries. There's one entry for each file in the archive. IMPLEMENTATION NOTES (contains excerpts from http://www.pkware.com/documents/casestudies/APPNOTE.TXT) Overall .ZIP file format: [local file header 1] [file data 1] [data descriptor 1] . . . [local file header n] [file data n] [data descriptor n] [archive decryption header] [archive extra data record] [central directory] [zip64 end of central directory record] [zip64 end of central directory locator] [end of central directory record] An archive instance is built from the last section in the file, [end of central directory record], containing the metadata associated with the archive as a whole and then initialized with entries from the central directory section (see ZipArchiveEntry for details on that). I. End of central directory record: end of central dir signature 4 bytes (0x06054b50) number of this disk 2 bytes number of the disk with the start of the central directory 2 bytes total number of entries in the central directory on this disk 2 bytes total number of entries in the central directory 2 bytes size of the central directory 4 bytes offset of start of central directory with respect to the starting disk number 4 bytes .ZIP file comment length 2 bytes .ZIP file comment (variable size) Instance Variables: stream <ReadStream> binary readable, positionable stream containing the .ZIP archive directory <UninterpretedBytes> the central directory of the archive entries <Array> all the archive entries comment <String> optional archive comment
</comment> <class> <name>StoredStream</name> <environment>OS.Zip</environment> <super>OS.ZLib.LimitedReadStream</super> <private>false</private> none header fileName extraField <imports></imports> <category>Compression-Zip</category> <attributes> <package>Compression-Zip</package> </attributes> </class> <comment> OS.Zip.StoredStream
Reads files archived using the 'stored' compression method ('stored' means no compression, the file is archived as is). Instance Variables: header <FileHeader> the local file header fileName <String> the stored file name extraField <String> the extra field value
</comment> <class> <name>ArchiveEntry</name> <environment>OS.Zip</environment> <super>Core.Object</super> <private>false</private> none stream header fileName extraField comment <imports></imports> <category>Zlib Interface</category> <attributes> <package>Compression-Zip</package> </attributes> </class> <comment> OS.Zip.ArchiveEntry
Encapsulates a single file entry in a Zip file's central directory structure and provides access to the corresponding file. IMPLEMENTATION NOTES (contains excerpts from http://www.pkware.com/documents/casestudies/APPNOTE.TXT) Overall .ZIP file format: [local file header 1] [file data 1] [data descriptor 1] . . . [local file header n] [file data n] [data descriptor n] [archive decryption header] [archive extra data record] [central directory] [zip64 end of central directory record] [zip64 end of central directory locator] [end of central directory record] An entry represents a single entry in archive's [central directory]. F. Central directory structure: [file header 1] . . . [file header n] [digital signature] File header: central file header signature 4 bytes (0x02014b50) version made by 2 bytes version needed to extract 2 bytes general purpose bit flag 2 bytes compression method 2 bytes last mod file time 2 bytes last mod file date 2 bytes crc-32 4 bytes compressed size 4 bytes uncompressed size 4 bytes file name length 2 bytes extra field length 2 bytes file comment length 2 bytes disk number start 2 bytes internal file attributes 2 bytes external file attributes 4 bytes relative offset of local header 4 bytes file name (variable size) extra field (variable size) file comment (variable size) Digital signature: header signature 4 bytes (0x05054b50) size of data 2 bytes signature data (variable size) With the introduction of the Central Directory Encryption feature in version 6.2 of this specification, the Central Directory Structure may be stored both compressed and encrypted. Although not required, it is assumed when encrypting the Central Directory Structure, that it will be compressed for greater storage efficiency. Information on the Central Directory Encryption feature can be found in the section describing the Strong Encryption Specification. The Digital Signature record will be neither compressed nor encrypted. Instance Variables: stream <ReadStream> binary, positionable read stream containing the ZIP archive header <UninterpretedBytes> the fixed contents of the header fileName <String> the name of the file extraField <String> extra field comment <String> optional file comment
</comment> <class> <name>FileAlreadyExists</name> <environment>OS.Zip</environment> <super>Core.Warning</super> <private>false</private> none <imports></imports> <category>My Classes</category> <attributes> <package>Compression-Zip</package> </attributes> </class> <comment> OS.Zip.FileAlreadyExists
Raised when extracting an entry into a file and the file already exists. The parameter carries the original file name. Returning from the handler will stop the extraction and leave the original file unmodified. Resuming the exception will overwrite the original file with the contents of the entry. Resuming with a different name will extract the entry using the new name. If the new name also matches an existing file, the file will be overwritten without warning. archive := OS.Zip.Archive filename: 'archive.zip'. [ archive entries last extractTo: '.' ] on: FileAlreadyExists do: [ :ex | ex resume: 'newName.txt' ]. archive close
</comment> <class> <name>FileHeader</name> <environment>OS.Zip</environment> <super>Core.UninterpretedBytes</super> <private>true</private> bytes <imports></imports> <category>Compression-Zip</category> <attributes> <package>Compression-Zip</package> </attributes> </class> <comment> OS.Zip.FileHeader
Helps ZipReadStream and ZipStoredStream deal with their headers.
</comment> <class> <name>DeflatedStream</name> <environment>OS.Zip</environment> <super>OS.ZLib.InflateStream</super> <private>false</private> none checkCrc crc header fileName extraField <imports></imports> <category>Zlib Interface</category> <attributes> <package>Compression-Zip</package> </attributes> </class> <comment> OS.Zip.DeflatedStream
Provides access to the decompressed contents and the adjacent attributes of a file stored in a ZIP archive. It is generally obtained from a ZIP archive entry through the #readStream method. IMPLEMENTATION NOTES (contains excerpts from http://www.pkware.com/documents/casestudies/APPNOTE.TXT) Overall .ZIP file format: [local file header 1] [file data 1] [data descriptor 1] . . . [local file header n] [file data n] [data descriptor n] [archive decryption header] [archive extra data record] [central directory] [zip64 end of central directory record] [zip64 end of central directory locator] [end of central directory record] The stream reads the [local file header] and is then ready to decompress the [file data]. No support for [data descriptor] yet. A. Local file header: local file header signature 4 bytes (0x04034b50) version needed to extract 2 bytes general purpose bit flag 2 bytes compression method 2 bytes last mod file time 2 bytes last mod file date 2 bytes crc-32 4 bytes compressed size 4 bytes uncompressed size 4 bytes file name length 2 bytes extra field length 2 bytes file name (variable size) extra field (variable size) B. File data Immediately following the local header for a file is the compressed or stored data for the file. The series of [local file header][file data][data descriptor] repeats for each file in the .ZIP archive. C. Data descriptor: crc-32 4 bytes compressed size 4 bytes uncompressed size 4 bytes This descriptor exists only if bit 3 of the general purpose bit flag is set (see below). It is byte aligned and immediately follows the last byte of compressed data. This descriptor is used only when it was not possible to seek in the output .ZIP file, e.g., when the output .ZIP file was standard output or a non-seekable device. For ZIP64(tm) format archives, the compressed and uncompressed sizes are 8 bytes each. When compressing files, compressed and uncompressed sizes should be stored in ZIP64 format (as 8 byte values) when a files size exceeds 0xFFFFFFFF. However ZIP64 format may be used regardless of the size of a file. When extracting, if the zip64 extended information extra field is present for the file the compressed and uncompressed sizes will be 8 byte values. Although not originally assigned a signature, the value 0x08074b50 has commonly been adopted as a signature value for the data descriptor record. Implementers should be aware that ZIP files may be encountered with or without this signature marking data descriptors and should account for either case when reading ZIP files to ensure compatibility. When writing ZIP files, it is recommended to include the signature value marking the data descriptor record. When the signature is used, the fields currently defined for the data descriptor record will immediately follow the signature. An extensible data descriptor will be released in a future version of this APPNOTE. This new record is intended to resolve conflicts with the use of this record going forward, and to provide better support for streamed file processing. When the Central Directory Encryption method is used, the data descriptor record is not required, but may be used. If present, and bit 3 of the general purpose bit field is set to indicate its presence, the values in fields of the data descriptor record should be set to binary zeros. Instance Variables: checkCrc <Boolean> should we perform CRC checking on the contents during decompression crc <Integer> running CRC value header <FileHeader> the local file header fileName <String> the stored file name extraField <String> the extra field value
</comment> <name>LocalFileHeaderSignature</name> <environment>OS.Zip</environment> <private>false</private> <constant>true</constant> <category>miscellanous constants</category> <initializer> "Marks the begining of a local file header" #[16r50 16r4b 16r03 16r04]</initializer> <attributes> <package>Compression-Zip</package> </attributes> <name>EndCentralDirectorySignature</name> <environment>OS.Zip</environment> <private>false</private> <constant>true</constant> <category>miscellanous constants</category> <initializer> "Marks the beginging of the final directory section" #[16r50 16r4b 16r05 16r06]</initializer> <attributes> <package>Compression-Zip</package> </attributes> <name>CentralFileHeaderSignature</name> <environment>OS.Zip</environment> <private>false</private> <constant>false</constant> <category>miscellanous constants</category> <initializer> "Marks the begining of a directory entry" #[16r50 16r4b 16r01 16r02]</initializer> <attributes> <package>Compression-Zip</package> </attributes> <name>CompressionStreamMap</name> <environment>OS.Zip</environment> <private>false</private> <constant>false</constant> <category>miscellanous constants</category> <initializer>["Maps compression method codes to stream classes that implement those methods." "The error handling below is just to work around current limitations of Shared Variable initialization. It will go away as soon as that is improved. All the relevant bits of this initializer are inside the first block below. You can safely ignore the rest." Dictionary new at: Stored put: StoredStream; at: Deflated put: DeflatedStream; yourself] on: SubscriptOutOfBoundsError do: [:ex | ex index isNil ifTrue: ["This happens if the shared variables that this depends on were not initialized yet" ex return: Dictionary new] ifFalse: [ex pass "Something else is wrong"]]</initializer> <attributes> <package>Compression-Zip</package> </attributes> <name>Reduced3</name> <environment>OS.Zip</environment> <private>false</private> <constant>true</constant> <category>compression method codes</category> <initializer> "Compression method code." ^4</initializer> <attributes> <package>Compression-Zip</package> </attributes> <name>Stored</name> <environment>OS.Zip</environment> <private>false</private> <constant>true</constant> <category>compression method codes</category> <initializer> "Compression method code." ^0</initializer> <attributes> <package>Compression-Zip</package> </attributes> <name>Imploded</name> <environment>OS.Zip</environment> <private>false</private> <constant>true</constant> <category>compression method codes</category> <initializer> "Compression method code." ^6</initializer> <attributes> <package>Compression-Zip</package> </attributes> <name>Reduced4</name> <environment>OS.Zip</environment> <private>false</private> <constant>true</constant> <category>compression method codes</category> <initializer> "Compression method code." ^5</initializer> <attributes> <package>Compression-Zip</package> </attributes> <name>Reduced2</name> <environment>OS.Zip</environment> <private>false</private> <constant>true</constant> <category>compression method codes</category> <initializer> "Compression method code." ^3</initializer> <attributes> <package>Compression-Zip</package> </attributes> <name>Reduced1</name> <environment>OS.Zip</environment> <private>false</private> <constant>true</constant> <category>compression method codes</category> <initializer> "Compression method code." ^2</initializer> <attributes> <package>Compression-Zip</package> </attributes> <name>PKImploded</name> <environment>OS.Zip</environment> <private>false</private> <constant>true</constant> <category>compression method codes</category> <initializer> "Compression method code." ^10</initializer> <attributes> <package>Compression-Zip</package> </attributes> <name>Deflated</name> <environment>OS.Zip</environment> <private>false</private> <constant>true</constant> <category>compression method codes</category> <initializer> "Compression method code." ^8</initializer> <attributes> <package>Compression-Zip</package> </attributes> <name>Shrunk</name> <environment>OS.Zip</environment> <private>false</private> <constant>true</constant> <category>compression method codes</category> <initializer> "Compression method code." ^1</initializer> <attributes> <package>Compression-Zip</package> </attributes> <methods> OS.ZLib.LimitedReadStream <category>initialize-release</category>
on: sourceStream limit: limit stream := sourceStream. readLimit := limit
</methods> <methods> OS.ZLib.LimitedReadStream <category>testing</category>
atEnd ^stream position >= readLimit or: [ stream atEnd ]
isReadable ^true
isWritable "Answer whether the stream implements #nextPut:." ^false
</methods> <methods> OS.ZLib.LimitedReadStream <category>accessing</category>
next self atEnd ifTrue: [EndOfStreamNotification raiseRequestFrom: self]. ^stream next
next: anInteger into: aSequenceableCollection startingAt: startIndex "Store the next anInteger elements of the receiver into aSequenceableCollection starting at startIndex in aSequenceableCollection. Answer aSequenceableCollection." | amount | amount := anInteger min: (readLimit - stream position). stream next: amount into: aSequenceableCollection startingAt: startIndex. amount < anInteger ifTrue: [ IncompleteNextCountError raiseRequestWith: amount ]. ^aSequenceableCollection
</methods> <methods> OS.ZLib.LimitedReadStream <category>private</category>
contentsSpecies ^stream contentsSpecies
</methods> <methods> OS.ZLib.LimitedReadStream class <category>instance creation</category>
on: sourceStream limit: limit ^self basicNew on: sourceStream limit: limit
</methods> <methods> OS.Zip.Archive <category>accessing</category>
comment ^comment
commentLength ^directory unsignedShortAt: 21 bigEndian: false
directoryDiskNumber ^directory unsignedShortAt: 7 bigEndian: false
directoryOffset ^directory unsignedLongAt: 17 bigEndian: false
directorySize ^directory unsignedLongAt: 13 bigEndian: false
diskNumber ^directory unsignedShortAt: 5 bigEndian: false
entries ^entries
totalEntries ^directory unsignedShortAt: 11 bigEndian: false
totalEntriesOnDisk ^directory unsignedShortAt: 9 bigEndian: false
</methods> <methods> OS.Zip.Archive <category>debugging</category>
inspectorExtraAttributes ^#{Tools.Trippy.TextAttribute} ifDefinedDo: [ :class | OrderedCollection new add: (class label: 'total number of entries' text: self totalEntries printString); add: (class label: 'total number of entries on disk' text: self totalEntriesOnDisk printString); add: (class label: 'directory size' text: self directorySize printString); add: (class label: 'disk number' text: self diskNumber printString); add: (class label: 'directory disk number' text: self directoryDiskNumber printString); add: (class label: 'directory offset' text: self directoryOffset printString); yourself ] elseDo: [ Array new ]
</methods> <methods> OS.Zip.Archive <category>initialize-release</category>
on: aStream stream := aStream. stream reset. (stream next: 4) ~= LocalFileHeaderSignature ifTrue: [^self error: 'Not a zip file - invalid signature']. "The following can be made a good bit faster by scanning smaller blocks for the signature. But this is the easiest for now..." stream position: (0 max: (stream size - self class maxEndCentralDirectorySize)). (stream skipToAll: EndCentralDirectorySignature) isNil ifTrue: [^self error: 'End of central directory signature not found']. directory := (stream next: 22) changeClassTo: UninterpretedBytes. (self diskNumber ~= 0 or: [ self directoryDiskNumber ~= 0 or: [ self totalEntriesOnDisk ~= self totalEntries ] ] ) ifTrue: [^self error: 'Multiple disk archives are not currently supported.']. comment := (stream next: self commentLength) asString. entries := Array new: self totalEntries. stream position: self directoryOffset. 1 to: self totalEntries do: [ :i | entries at: i put: (ArchiveEntry on: stream) ]
</methods> <methods> OS.Zip.Archive <category>services</category>
close stream close
extractTo: targetDirectory "Extract all files from this archive into the provided directory. The directory must already exist. Note that for convenience this method will automatically close the archive. directory <Filename|String> an existing directory to extract into " self entries do: [ :entry | entry extractTo: targetDirectory ]. self close
</methods> <methods> OS.Zip.Archive class <category>DOS utility</category>
dateFromDOS: aDOSFormattedDate "Given a date in DOS 2-byte format, answer an instance of Date." ^Date newDay: (aDOSFormattedDate bitAnd: 16r1F) monthNumber: ((aDOSFormattedDate bitShift: -5) bitAnd: 16rF) year: 1980 + (aDOSFormattedDate bitShift: -9)
timeFromDOS: aDOSFormattedTime "Given a time in DOS 2-byte format, answer an instance of Time." ^Time fromSeconds: (((aDOSFormattedTime bitShift: -11) * 60 * 60) "hours" + (((aDOSFormattedTime bitShift: -5) bitAnd: 16r3F) * 60) "minutes" + (aDOSFormattedTime bitAnd: 16r1F)) "seconds"
</methods> <methods> OS.Zip.Archive class <category>instance creation</category>
filename: aFilename | stream | stream := aFilename asFilename readStream binary. ^self on: stream
on: aStream ^self new on: aStream
</methods> <methods> OS.Zip.Archive class <category>constants</category>
maxEndCentralDirectorySize "Maximum size of the 'end of central directory record' is the fixed size plus the maximum variable comment size. Since the comment size is defined in 2 bytes, it can't be greater than 65535." ^65535 + self minEndCentralDirectorySize
minEndCentralDirectorySize ^22
</methods> <methods> OS.Zip.StoredStream <category>accessing</category>
compressedSize ^header compressedSize
compressionMethod ^header compressionMethod
crc32 ^header crc32
extraField ^extraField
extraFieldLength ^header extraFieldLength
fileName ^fileName
fileNameLength ^header fileNameLength
generalBitFlags ^header generalBitFlags
lastModificationDate ^header lastModificationDate
lastModificationTime ^header lastModificationTime
uncompressedSize ^header uncompressedSize
versionToExtract ^header versionToExtract
</methods> <methods> OS.Zip.StoredStream <category>initialize-release</category>
on: sourceStream (sourceStream next: 4) ~= LocalFileHeaderSignature ifTrue: [^self error: 'Local file header signature not found.']. header := (sourceStream next: 26) changeClassTo: FileHeader. fileName := (sourceStream next: header fileNameLength) asString. extraField := (sourceStream next: header extraFieldLength) asString. super on: sourceStream limit: sourceStream position + header uncompressedSize
</methods> <methods> OS.Zip.StoredStream <category>debugging</category>
inspectorExtraAttributes ^#{Tools.Trippy.TextAttribute} ifDefinedDo: [ :class | OrderedCollection new add: (class label: 'compressed size' text: self compressedSize printString); add: (class label: 'uncompressed size' text: self uncompressedSize printString); add: (class label: 'modification time' text: self lastModificationTime printString); add: (class label: 'modification date' text: self lastModificationDate printString); add: (class label: 'compression method' text: self compressionMethod printString); add: (class label: 'version needed to extract' text: self versionToExtract printString); add: (class label: 'CRC-32' text: self crc32 printString); add: (class label: 'flags' text: self generalBitFlags printString); yourself ] elseDo: [ Array new ]
</methods> <methods> OS.Zip.StoredStream class <category>instance </category>
on: sourceStream ^self basicNew on: sourceStream
on: sourceStream limit: limit ^self error: 'The limit will be read from the stream header, use #on: instead!'
</methods> <methods> OS.Zip.ArchiveEntry <category>services</category>
contents ^self readStream next: self uncompressedSize
extractTo: directory "Extract this file into the provided directory. The directory must already exist. Note that this method will not automatically close the archive (assuming other entries might be extracted too). directory <Filename|String> an existing directory to extract into " | path last file buffer source | path := (self fileName tokensBasedOn: $/). self isDirectory ifFalse: [ last := path last. path := path copyFrom: 1 to: path size - 1 ]. file := path inject: directory asFilename into: [ :parent :name || filename | filename := parent construct: name. filename exists ifFalse: [ filename makeDirectory ]. filename ]. self isDirectory ifTrue: [ ^self "we're done" ]. file := file construct: last. file exists ifTrue: [ last := (FileAlreadyExists raiseRequestWith: last) ifNil: [ ^self ]. file := file directory construct: last ]. file := file writeStream binary; yourself. [ buffer := ByteArray new: 4096. source := self readStream. [ source atEnd ] whileFalse: [ file next: (source nextAvailable: buffer size into: buffer startingAt: 1) putAll: buffer startingAt: 1 ] ] ensure: [ file close ]
readStream "Decompress the compressed file that I refer to and answer it as a single ByteArray." stream position: self offset. ^(self streamClassFor: self compressionMethod) on: stream
</methods> <methods> OS.Zip.ArchiveEntry <category>testing</category>
isDirectory ^self fileName last = $/
</methods> <methods> OS.Zip.ArchiveEntry <category>initialize-release</category>
on: aStream "Assume that aStream is pre-positioned, ready to load up a file header from the directory." stream := aStream. (aStream next: 4) ~= CentralFileHeaderSignature ifTrue: [^self error: 'Central file header signature not found.']. header := (stream next: 42) changeClassTo: UninterpretedBytes. self diskNumber ~= 0 ifTrue: [self error: 'Multi-part archives not currently supported.']. fileName := (aStream next: self fileNameLength) asString. extraField := (aStream next: self extraFieldLength) asString. comment := (aStream next: self commentLength) asString.
</methods> <methods> OS.Zip.ArchiveEntry <category>debugging</category>
inspectorExtraAttributes ^#{Tools.Trippy.TextAttribute} ifDefinedDo: [ :class | OrderedCollection new add: (class label: 'compressed size' text: self compressedSize printString); add: (class label: 'uncompressed size' text: self uncompressedSize printString); add: (class label: 'modification time' text: self lastModificationTime printString); add: (class label: 'modification date' text: self lastModificationDate printString); add: (class label: 'compression method' text: self compressionMethod printString); add: (class label: 'made by version' text: self madeByVersion printString); add: (class label: 'version needed to extract' text: self versionToExtract printString); add: (class label: 'disk number' text: self diskNumber printString); add: (class label: 'CRC-32' text: self crc32 printString); add: (class label: 'flags' text: self generalBitFlags printString); add: (class label: 'external attributes' text: self externalAttributes printString); add: (class label: 'internal attributes' text: self internalAttributes printString); yourself ] elseDo: [ Array new ]
</methods> <methods> OS.Zip.ArchiveEntry <category>accessing</category>
commentLength ^header unsignedShortAt: 29 bigEndian: false
compressedSize ^header unsignedLongAt: 17 bigEndian: false
compressionMethod ^header unsignedShortAt: 7 bigEndian: false
crc32 ^header unsignedLongAt: 13 bigEndian: false
diskNumber ^header unsignedShortAt: 31 bigEndian: false
externalAttributes ^header unsignedLongAt: 35 bigEndian: false
extraField ^extraField
extraFieldLength ^header unsignedShortAt: 27 bigEndian: false
fileName ^fileName
fileNameLength ^header unsignedShortAt: 25 bigEndian: false
generalBitFlags ^header unsignedShortAt: 5 bigEndian: false
internalAttributes ^header unsignedShortAt: 33 bigEndian: false
lastModificationDate ^Archive dateFromDOS: (header unsignedShortAt: 11 bigEndian: false)
lastModificationTime ^Archive timeFromDOS: (header unsignedShortAt: 9 bigEndian: false)
madeByVersion ^header unsignedShortAt: 1 bigEndian: false
offset ^header unsignedLongAt: 39 bigEndian: false
uncompressedSize ^header unsignedLongAt: 21 bigEndian: false
versionToExtract ^header unsignedShortAt: 3 bigEndian: false
</methods> <methods> OS.Zip.ArchiveEntry <category>printing</category>
printOn: aStream super printOn: aStream. aStream nextPut: $(; nextPutAll: self fileName displayString; nextPut: $).
</methods> <methods> OS.Zip.ArchiveEntry <category>private</category>
streamClassFor: method ^CompressionStreamMap at: self compressionMethod ifAbsent: [ self error: 'Unable to handle compression method ', self compressionMethod printString ]
</methods> <methods> OS.Zip.ArchiveEntry class <category>instance creation</category>
on: aStream ^self new on: aStream
</methods> <methods> OS.Zip.FileAlreadyExists <category>printing</category>
defaultMessageText ^(#FileAlreadyExists1s << #dialogs >> 'File <1s> already exists.') expandMacrosWith: parameter
</methods> <methods> OS.Zip.FileAlreadyExists <category>constants</category>
defaultResumeValue ^parameter
</methods> <methods> OS.Zip.FileAlreadyExists <category>private - actions</category>
defaultAction | replacement question | question := (#WhatFileNameShouldBeUsed1s << #dialogs >> '<1s><n>What file name should be used?') expandMacrosWith: self description. replacement := UI.Dialog request: question initialAnswer: parameter. ^replacement isEmpty ifTrue: [nil] ifFalse: [replacement]
</methods> <methods> OS.Zip.FileHeader <category>accessing</category>
compressedSize ^self unsignedLongAt: 15 bigEndian: false
compressionMethod ^self unsignedShortAt: 5 bigEndian: false
crc32 ^self unsignedLongAt: 11 bigEndian: false
extraFieldLength ^self unsignedShortAt: 25 bigEndian: false
fileNameLength ^self unsignedShortAt: 23 bigEndian: false
generalBitFlags ^self unsignedShortAt: 3 bigEndian: false
lastModificationDate ^Archive dateFromDOS: (self unsignedShortAt: 9 bigEndian: false)
lastModificationTime ^Archive timeFromDOS: (self unsignedShortAt: 7 bigEndian: false)
uncompressedSize ^self unsignedLongAt: 19 bigEndian: false
versionToExtract ^self unsignedShortAt: 1 bigEndian: false
</methods> <methods> OS.Zip.DeflatedStream <category>accessing</category>
checkCrc: aBoolean checkCrc := aBoolean
compressedSize ^header compressedSize
compressionMethod ^header compressionMethod
crc ^crc
crc32 ^header crc32
extraField ^extraField
extraFieldLength ^header extraFieldLength
fileName ^fileName
fileNameLength ^header fileNameLength
generalBitFlags ^header generalBitFlags
lastModificationDate ^header lastModificationDate
lastModificationTime ^header lastModificationTime
uncompressedSize ^header uncompressedSize
versionToExtract ^header versionToExtract
</methods> <methods> OS.Zip.DeflatedStream <category>private</category>
checkHeader (sourceStream next: 4) ~= LocalFileHeaderSignature ifTrue: [^self error: 'Local file header signature not found.']. header := (sourceStream next: 26) changeClassTo: FileHeader. fileName := (sourceStream next: self fileNameLength) asString. extraField := (sourceStream next: self extraFieldLength) asString. (checkCrc := self crc32 isZero not) ifTrue: [ crc := interface cCrc32: 16rffffffff buffer: 0 length: 0 ]
nextBuffer | notAtEnd | notAtEnd := super nextBuffer. checkCrc ifTrue: [ readLimit > 0 ifTrue: [crc := interface cCrc32: crc buffer: collection length: readLimit]. notAtEnd ifFalse: [ crc ~= self crc32 ifTrue: [self error: 'file crc error']. interface total_out ~= self uncompressedSize ifTrue: [self error: 'file length error']] ]. ^notAtEnd
</methods> <methods> OS.Zip.DeflatedStream <category>debugging</category>
inspectorExtraAttributes ^#{Tools.Trippy.TextAttribute} ifDefinedDo: [ :class | OrderedCollection new add: (class label: 'compressed size' text: self compressedSize printString); add: (class label: 'uncompressed size' text: self uncompressedSize printString); add: (class label: 'modification time' text: self lastModificationTime printString); add: (class label: 'modification date' text: self lastModificationDate printString); add: (class label: 'compression method' text: self compressionMethod printString); add: (class label: 'version needed to extract' text: self versionToExtract printString); add: (class label: 'CRC-32' text: self crc32 printString); add: (class label: 'flags' text: self generalBitFlags printString); yourself ] elseDo: [ Array new ]
</methods> "Imported Classes:" self error: 'Attempting to file-in parcel imports. Choose terminate or close' <class> <name>Object</name> <environment>Core</environment> <super></super> <private>false</private> none <imports></imports> <category>Kernel-Objects</category> <attributes> <package>Kernel-Objects</package> </attributes> </class> <class> <name>Stream</name> <environment>Core</environment> <super>Core.Object</super> <private>false</private> none <imports> private IOConstants.* </imports> <category>Collections-Streams</category> <attributes> <package>Collections-Streams</package> </attributes> </class> <class> <name>Warning</name> <environment>Core</environment> <super>Core.Exception</super> <private>false</private> none <imports></imports> <category>Kernel-Exception Handling</category> <attributes> <package>Kernel-Exception Handling</package> </attributes> </class> <class> <name>UninterpretedBytes</name> <environment>Core</environment> <super>Core.Object</super> <private>false</private> bytes <imports></imports> <category>Kernel-Objects</category> <attributes> <package>Kernel-Objects</package> </attributes> </class> <class> <name>InflateStream</name> <environment>OS.ZLib</environment> <super>Core.ReadStream</super> <private>false</private> none inputBuffer inputLimit interface sourceStream superPosition eof <imports></imports> <category>Compression-ZLib</category> <attributes> <package>Compression-ZLib</package> </attributes> </class>