eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'CompressionStream':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: CompressionStream


Inheritance:

   Object
   |
   +--Stream
      |
      +--CompressionStream
         |
         +--BZip2Stream
         |
         +--ZipStream

Package:
stx:libbasic2
Category:
Streams-Compressed
Version:
rev: 1.42 date: 2018/05/02 14:07:43
user: cg
file: CompressionStream.st directory: libbasic2
module: stx stc-classLibrary: libbasic2
Author:
Claus Atzkern

Description:


Abstract superclass of streams that compress or decompress data


[instance variables:]

[class variables:]


Related information:

    ZipStream

Class protocol:

defaults
o  defaultSuppressHeaderAndChecksum

initialization
o  initialize

instance creation
o  readOpenOn: aStream
open to read data from an compressed stream

o  readOpenOn: aStream suppressHeaderAndChecksum: aBoolean
open to read data from an compressed stream

o  writeOpenOn: aStream
open to write data compressed to stream

o  writeOpenOn: aStream suppressHeaderAndChecksum: aBoolean
open to write data compressed to stream

queries
o  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.


Instance protocol:

accessing
o  binary
switch to binary mode - default is text

o  propagateClose

o  propagateClose: aBoolean
close the underlying stream if the zip stream is closed

o  text
switch to text mode - default is text

error handling
o  errorNotOpen
report an error, that the stream has not been opened

o  errorReadOnly
report an error, that the stream is a readOnly stream

o  errorWriteOnly
report an error, that the stream is a writeOnly stream

o  invalidArgument
called if a method is invoked with invalid parameters

o  zerror: anError

finalization
o  executor
redefined to return a lightweight copy
- all we need is the memory handle

o  finalize
the compressin-stream was garbage collected;
close the underlying zip-stream

o  finalizeCopy: aZStream
used for finalization to close the underlying zip-stream

low level
o  z_nextAvailableInto: aCollection startingAt: offset maxCount: maxCount
read the next available bytes into a collection, a string or byteArray;
returns the size read

o  zclose
low level close of the zip stream

** This method raises an error - it must be redefined in concrete classes **

o  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 **

o  zdeflateInit
low level - deflateInit
initialize the deflate mode, write header

** This method raises an error - it must be redefined in concrete classes **

o  zget_avail_out
low level - get the number of available out bytes

** This method raises an error - it must be redefined in concrete classes **

o  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 **

o  zinflateInit
low level - inflateInit
initialize the inflate mode, read and check header

** This method raises an error - it must be redefined in concrete classes **

o  zopen
low level - opens the zip stream
create the resources

** This method raises an error - it must be redefined in concrete classes **

o  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
o  closeZStream
close the zip-stream

o  contentsSpecies
return the kind of object to be returned by sub-collection builders

o  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.

o  onStreamPutBytes: count from: data
write compressed data to the (output) stream

queries
o  atEnd
return true if the end of the compressed input stream has been reached

o  isBinary
return true, if the stream is in binary (as opposed to text-) mode.
The default when created is false

o  isHeaderAndChecksumSuppressed
answer true if the checksum and header are suppressed;
the default is true (backward compatibility)

o  isOpen
return true, if this stream is open

o  isReadable
return true, if this stream can be read from

o  isWritable
return true, if this stream can be written to

reading
o  contents
return the entire contents of and close the stream

o  next
return the next element,
as character (text mode) or byte (binary mode).
Possibly raises ReadPastEnd error, if there are no more elements

o  next: n
return the next count elements of the stream as a collection.
Redefined to return a String or ByteArray and for optimization

o  next: n into: aBuffer startingAt: startIndex
read the next n elements of the stream into aBuffer.
Return the number of bytes read.

o  nextByte
return the next element, a byte
raise an error, if there are no more elements

o  nextByteOrNil
return the next element, a byte
return nil, if there are no more elements

o  nextBytes: numBytes into: aByteCollection startingAt: initialIndex
can do it faster here than in super class

o  nextOrNil
return the next element,
as character (text mode) or byte (binary mode).
return nil, if there are no more elements

o  skip: count
skip count objects, return the receiver
redefined for optimization

startup & release
o  close
close the zip-stream

o  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

o  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

o  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).

o  streamOpenWithMode: aMode on: aStream

o  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
o  contents: contents
write the entire contents to and close the stream

o  flush
flush the input and output buffer

o  nextPut: aByteOrCharacter
write the argument, aByteOrCharacter

o  nextPutAll: aCollection



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Sat, 21 Jul 2018 07:58:42 GMT