CompressionStream.st
changeset 4644 a55695d86845
parent 4311 55d6e8abb73b
child 4840 0bd1739f7758
equal deleted inserted replaced
4643:b01920109e34 4644:a55695d86845
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 2002 by eXept Software AG
     4  COPYRIGHT (c) 2002 by eXept Software AG
     3 	      All Rights Reserved
     5 	      All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
   506 
   508 
   507 next:n into:aBuffer startingAt:startIndex
   509 next:n into:aBuffer startingAt:startIndex
   508     "read the next n elements of the stream into aBuffer.
   510     "read the next n elements of the stream into aBuffer.
   509      Return the number of bytes read."
   511      Return the number of bytes read."
   510 
   512 
   511     |count remaining offset|
   513     |count remaining offset fillOK|
   512 
   514 
   513     mode ~~ #readonly ifTrue:[
   515     mode ~~ #readonly ifTrue:[
   514         self errorWriteOnly
   516         self errorWriteOnly
   515     ].
   517     ].
   516     self fillBuffer ifFalse:[
   518     self fillBuffer ifFalse:[
   521 
   523 
   522     [
   524     [
   523         count  := self z_nextAvailableInto:aBuffer startingAt:offset maxCount:remaining.
   525         count  := self z_nextAvailableInto:aBuffer startingAt:offset maxCount:remaining.
   524         offset := count + offset.
   526         offset := count + offset.
   525         remaining := remaining - count.
   527         remaining := remaining - count.
   526         remaining ~~ 0 and:[self fillBuffer]
   528         remaining ~~ 0 and:[ fillOK := self fillBuffer]
   527     ] whileTrue.
   529     ] whileTrue.
       
   530     remaining ~~ 0 ifTrue:[
       
   531         self pastEndRead
       
   532     ].
   528     ^ n - remaining
   533     ^ n - remaining
   529 !
   534 !
   530 
   535 
   531 nextByte
   536 nextByte
   532     "return the next element, a byte 
   537     "return the next element, a byte