|
Class: CompressionStream
Object
|
+--Stream
|
+--CompressionStream
|
+--BZip2Stream
|
+--ZipStream
- Package:
- stx:libbasic2
- Category:
- Streams-Compressed
- Version:
- rev:
1.54
date: 2023/07/18 14:19:16
- user: stefan
- file: CompressionStream.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
Abstract superclass of streams that compress or decompress data
[instance variables:]
[class variables:]
copyrightCOPYRIGHT (c) 2002 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
class initialization
-
initialize
-
defaults
-
defaultSuppressHeaderAndChecksum
-
error handling
-
zerror: anError
-
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 must be redefined in concrete classes (subclassResponsibility) **
-
zdeflate
-
low level - deflate
returns false if the deflate operation is finished, otherwise true
** This method must be redefined in concrete classes (subclassResponsibility) **
-
zdeflateInit
-
low level - deflateInit
initialize the deflate mode, write header
** This method must be redefined in concrete classes (subclassResponsibility) **
-
zget_avail_out
-
low level - get the number of available out bytes
** This method must be redefined in concrete classes (subclassResponsibility) **
-
zinflate
-
low level - inflate
returns nil if at uncompress is finished, or the number of
available bytes in the output-buffer
** This method must be redefined in concrete classes (subclassResponsibility) **
-
zinflateInit
-
low level - inflateInit
initialize the inflate mode, read and check header
** This method must be redefined in concrete classes (subclassResponsibility) **
-
zopen
-
low level - opens the zip stream
create the resources
** This method must be redefined in concrete classes (subclassResponsibility) **
-
zset_avail_in: count
-
set the 'avail_in' and compute the crc
** This method must be redefined in concrete classes (subclassResponsibility) **
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
-
bufferSizeForNormalCopy
-
chunk size when reading from/writing to a Stream
-
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.
Answer aByteOrCharacter
-
nextPutAll: aCollection
-
Write each of the objects in aCollection to the receiver stream.
Answer the receiver.
-
nextPutBytes: count from: aStringOrBytes startingAt: startIndex
-
Write each of the objects in aCollection to the receiver stream.
Answer the receiver.
|