eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ReadStream':

Home

everywhere
www.exept.de
for:
[back]

Class: ReadStream


Inheritance:

   Object
   |
   +--Stream
      |
      +--PeekableStream
         |
         +--PositionableStream
            |
            +--ReadStream
               |
               +--FCGI::FCGIReadStream

Package:
stx:libbasic
Category:
Streams
Version:
rev: 1.64 date: 2009/11/05 16:25:23
user: stefan
file: ReadStream.st directory: libbasic
module: stx stc-classLibrary: libbasic
Author:
Claus Gittinger

Description:


ReadStream defines protocol for reading streamwise over collections. 


Class protocol:

blocked instance creation
o  with: aCollection
with on readStream makes no sense
- what do you want to read from the end of a collection?

** This is an obsolete interface - do not use it (it may vanish in future versions) **


Instance protocol:

converting
o  readStream
return a readStream from the receiver. Since this is already
a readStream, return self.

o  readStreamOrNil
return a readStream from the receiver. Since this is already
a readStream, return self.

This method has been defined for protocol copmatibility with Filename

emphasis
o  emphasis
return the emphasis of the current (i.e. next returned by #next)
element. Streams on a string will return nil for all elements.
Streams on collections which nothing at all about emphasises,
will report an error.

queries
o  copyFrom: beginning to: end

o  isReadable
return true, if reading is supported by the recevier.
Here, true is always returned.

o  isWritable
return true, if writing is supported by the recevier.
This has to be redefined in concrete subclasses.

o  size
return the number of elements in the streamed collection.

reading
o  next
return the next element; advance read pointer.
return nil, if there is no next element.
- tuned for a bit more speed on String/ByteArray/Array-Streams

o  next: count
return the next count elements of the stream as aCollection,
which depends on the streams type - (see #contentsSpecies).

o  nextAlphaNumericWord
read the next word (i.e. up to non letter-or-digit).
return a string containing those characters.
Skips any non-alphanumeric chars first.
- tuned for speed on String-Streams for faster scanning

o  nextByte
return the next element; advance read pointer.
return nil, if there is no next element.
- tuned for a bit more speed on String/ByteArray/Array-Streams

o  nextBytes: numBytes into: aCollection startingAt: initialIndex
return the next numBytes from the stream. If the end is
reached before, only that many bytes are copyied into the
collection.
Returns the number of bytes that have been actually read.
The receiver must support reading of binary bytes.

Notice: this method is provided here for protocol completeness
with externalStreams - it is normally not used with other
streams.

o  nextDecimalInteger
read the next integer in radix 10. dont skip whitespace.
- tuned for speed on String-Streams for faster scanning

o  nextOrNil
return the next element; advance read pointer.
return nil, if there is no next element.
- tuned for a bit more speed on String/ByteArray/Array-Streams

o  nextPeek
advance read pointer return the peek element.
this is equivalent to (self next; peek).
- tuned for speed on String-Streams for faster scanning

o  peek
return the next element; do NOT advance read pointer.
return nil, if there is no next element.
- tuned for a bit more speed on String/ByteArray/Array-Streams

o  peekOrNil
return the next element; do NOT advance read pointer.
return nil, if there is no next element.
This is much like #peek -
However, unlike #peek, this does not raise an atEnd-query signal - even
if handled. Instead, nil is returned immediately.

o  skipSeparators
skip all whitespace; next will return next non-white-space element.
Return the peeked character or nil, if the end-of-stream was reached.
- reimplemented for speed on String-Streams for faster scanning

o  skipSeparatorsExceptCR
skip all whitespace except newlines;
next will return next non-white-space element.
- reimplemented for speed on String-Streams for faster scanning

o  skipThrough: anObject
skip all objects up-to and including anObject.
Return the receiver if skip was successful,
otherwise (i.e. if not found) return nil and leave the stream positioned at the end.
On success, the next read operation will return the element after anObject.
- reimplemented for speed on String-Streams for faster scanning

writing
o  nextPut: anElement
catch write access to readstreams - report an error



ST/X 6.1.1; WebServer 1.620 at exept:8081; Wed, 23 May 2012 20:50:30 GMT