ZipArchive.st
changeset 4376 4d4f6c0ef629
parent 4375 160854511e9d
child 4377 cb8861fa9361
equal deleted inserted replaced
4375:160854511e9d 4376:4d4f6c0ef629
  4179     "Modified: / 17-02-2017 / 22:57:43 / stefan"
  4179     "Modified: / 17-02-2017 / 22:57:43 / stefan"
  4180 ! !
  4180 ! !
  4181 
  4181 
  4182 !ZipArchive methodsFor:'reading - stream'!
  4182 !ZipArchive methodsFor:'reading - stream'!
  4183 
  4183 
  4184 extract:fileName intoStream: aWriteStream
  4184 extract:fileName intoStream:aWriteStream
  4185     "extract an entry indentified by filename into aWriteStream"
  4185     "extract an entry identified by filename into aWriteStream"
  4186 
  4186 
  4187     self 
  4187     self
  4188         withPositionAndMemberFor:fileName 
  4188         withPositionAndMemberFor:fileName
  4189         do:[:zmemb :position |
  4189         do:[:zmemb :position |
  4190             |buffer rdSize compressionMethod nextBlockSize streamBufferSize myZipStream|
  4190             |buffer rdSize compressionMethod nextBlockSize streamBufferSize myZipStream|
  4191 
  4191 
  4192             stream position:position.
  4192             stream position:position.
  4193 
  4193 
  4194             compressionMethod := zmemb compressionMethod.
  4194             compressionMethod := zmemb compressionMethod.
  4195             rdSize := zmemb uncompressedSize.
  4195             rdSize := zmemb uncompressedSize.
  4196             nextBlockSize := streamBufferSize := self class streamBufferSize.    
  4196             nextBlockSize := streamBufferSize := self class streamBufferSize.
  4197             buffer := ByteArray new: streamBufferSize.
  4197             buffer := ByteArray new: streamBufferSize.
  4198             [
  4198             [
  4199                 [rdSize > 0] whileTrue: [
  4199                 [rdSize > 0] whileTrue: [
  4200                     rdSize < streamBufferSize ifTrue: [
  4200                     rdSize < streamBufferSize ifTrue: [
  4201                         nextBlockSize := rdSize.
  4201                         nextBlockSize := rdSize.
  4222                 ].
  4222                 ].
  4223             ].
  4223             ].
  4224         ]
  4224         ]
  4225 
  4225 
  4226     "Modified: / 21-11-2010 / 11:56:51 / cg"
  4226     "Modified: / 21-11-2010 / 11:56:51 / cg"
       
  4227     "Modified (format): / 31-05-2017 / 15:03:06 / mawalch"
  4227 !
  4228 !
  4228 
  4229 
  4229 readStreamFor:nameOfFileInArchive
  4230 readStreamFor:nameOfFileInArchive
  4230     "open a stream on archive contents identified by nameOfFileInArchive"
  4231     "open a stream on archive contents identified by nameOfFileInArchive"
  4231 
  4232