|
Class: CompressionStream
Object
|
+--Stream
|
+--CompressionStream
|
+--BZip2Stream
|
+--ZipStream
- Package:
- stx:libbasic2
- Category:
- Streams-Compressed
- Version:
- rev:
1.43
date: 2019/03/13 19:15:10
- user: stefan
- file: CompressionStream.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
- Author:
- Claus Atzkern
Abstract superclass of streams that compress or decompress data
[instance variables:]
[class variables:]
ZipStream
defaults
-
defaultSuppressHeaderAndChecksum
-
initialization
-
initialize
-
instance creation
-
readOpenOn: aStream
-
open to read data from an compressed stream
-
readOpenOn: aStream suppressHeaderAndChecksum: aBoolean
-
open to read data from an compressed stream
-
writeOpenOn: aStream
-
open to write data compressed to stream
-
writeOpenOn: aStream suppressHeaderAndChecksum: aBoolean
-
open to write data compressed to stream
queries
-
isAbstract
-
Return if this class is an abstract class.
True is returned here for myself only; false for subclasses.
Abstract subclasses must redefine this again.
accessing
-
binary
-
switch to binary mode - default is text
-
binary: beBinaryBool
-
ExternalStream protocol compatibility:
switch to binary or text mode - default is text
-
propagateClose
-
-
propagateClose: aBoolean
-
close the underlying stream if the zip stream is closed
-
text
-
switch to text mode - default is text
error handling
-
errorNotOpen
-
report an error, that the stream has not been opened
-
errorReadOnly
-
report an error, that the stream is a readOnly stream
-
errorWriteOnly
-
report an error, that the stream is a writeOnly stream
-
invalidArgument
-
called if a method is invoked with invalid parameters
-
zerror: anError
-
finalization
-
executor
-
redefined to return a lightweight copy
- all we need is the memory handle
-
finalize
-
the compressin-stream was garbage collected;
close the underlying zip-stream
-
finalizeCopy: aZStream
-
used for finalization to close the underlying zip-stream
low level
-
z_nextAvailableInto: aCollection startingAt: offset maxCount: maxCount
-
read the next available bytes into a collection, a string or byteArray;
returns the size read
-
zclose
-
low level close of the zip stream
** This method raises an error - it must be redefined in concrete classes **
-
zdeflate
-
low level - deflate
returns false if the deflate operation is finished otherwise true
** This method raises an error - it must be redefined in concrete classes **
-
zdeflateInit
-
low level - deflateInit
initialize the deflate mode, write header
** This method raises an error - it must be redefined in concrete classes **
-
zget_avail_out
-
low level - get the number of available out bytes
** This method raises an error - it must be redefined in concrete classes **
-
zinflate
-
low level - inflate
returns nil if at uncompress is finished, or the number of
available bytes in the output-buffer
** This method raises an error - it must be redefined in concrete classes **
-
zinflateInit
-
low level - inflateInit
initialize the inflate mode, read and check header
** This method raises an error - it must be redefined in concrete classes **
-
zopen
-
low level - opens the zip stream
create the resources
** This method raises an error - it must be redefined in concrete classes **
-
zset_avail_in: count
-
set the 'avail_in' and compute the crc
** This method raises an error - it must be redefined in concrete classes **
private
-
closeZStream
-
close the zip-stream
-
contentsSpecies
-
return the kind of object to be returned by sub-collection builders
-
fillBuffer
-
Fill the inputBytes buffer.
returns true if data is available for reading;
false if the stream is at end.
Updates the readLimit and position.
-
onStreamPutBytes: count from: data
-
write compressed data to the (output) stream
queries
-
atEnd
-
return true if the end of the compressed input stream has been reached
-
isBinary
-
return true, if the stream is in binary (as opposed to text-) mode.
The default when created is false
-
isHeaderAndChecksumSuppressed
-
answer true if the checksum and header are suppressed;
the default is true (backward compatibility)
-
isOpen
-
return true, if this stream is open
-
isReadable
-
return true, if this stream can be read from
-
isWritable
-
return true, if this stream can be written to
reading
-
contents
-
return the entire contents of and close the stream
-
next
-
return the next element,
as character (text mode) or byte (binary mode).
Possibly raises ReadPastEnd error, if there are no more elements
-
next: n
-
return the next count elements of the stream as a collection.
Redefined to return a String or ByteArray and for optimization
-
next: n into: aBuffer startingAt: startIndex
-
read the next n elements of the stream into aBuffer.
Return the number of bytes read.
-
nextByte
-
return the next element, a byte
raise an error, if there are no more elements
-
nextByteOrNil
-
return the next element, a byte
return nil, if there are no more elements
-
nextBytes: numBytes into: aByteCollection startingAt: initialIndex
-
can do it faster here than in super class
-
nextOrNil
-
return the next element,
as character (text mode) or byte (binary mode).
return nil, if there are no more elements
-
skip: count
-
skip count objects, return the receiver
redefined for optimization
startup & release
-
close
-
close the zip-stream
-
openWithMode: aMode on: aStream
-
open the zip-stream on a stream
can be reimplemented to do some additional stuff (e.g. gzip header) like
in the ZipStream
-
openWithMode: aMode on: aStream suppressHeaderAndChecksum: aBoolean
-
open the zip-stream on a stream
can be reimplemented to do some additional stuff (e.g. gzip header) like
in the ZipStream
-
setInputStream: aStream
-
change the input stream (i.e. continue reading from aStream).
Useful if the input arrives in chunks, and we have to continue decompressing
from the next chunk (passing a readStream on the next chunk here).
-
streamOpenWithMode: aMode on: aStream
-
-
streamOpenWithMode: aMode on: aStream suppressHeaderAndChecksum: aBoolean
-
open the compression stream on a stream
#readonly uncompress the data derived from the read-stream, aStream
#writeonly compress the data and write to the write-stream, aStream
writing
-
contents: contents
-
write the entire contents to and close the stream
-
flush
-
flush the input and output buffer
-
nextPut: aByteOrCharacter
-
write the argument, aByteOrCharacter
-
nextPutAll: aCollection
-
|