|
|
Class: ReadStream
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
ReadStream defines protocol for reading streamwise over collections.
blocked instance creation
-
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) **
converting
-
readStream
-
return a readStream from the receiver. Since this is already
a readStream, return self.
-
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
-
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
-
copyFrom: beginning to: end
-
-
isReadable
-
return true, if reading is supported by the recevier.
Here, true is always returned.
-
isWritable
-
return true, if writing is supported by the recevier.
This has to be redefined in concrete subclasses.
-
size
-
return the number of elements in the streamed collection.
reading
-
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
-
next: count
-
return the next count elements of the stream as aCollection,
which depends on the streams type - (see #contentsSpecies).
-
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
-
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
-
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.
-
nextDecimalInteger
-
read the next integer in radix 10. dont skip whitespace.
- tuned for speed on String-Streams for faster scanning
-
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
-
nextPeek
-
advance read pointer return the peek element.
this is equivalent to (self next; peek).
- tuned for speed on String-Streams for faster scanning
-
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
-
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.
-
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
-
skipSeparatorsExceptCR
-
skip all whitespace except newlines;
next will return next non-white-space element.
- reimplemented for speed on String-Streams for faster scanning
-
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
-
nextPut: anElement
-
catch write access to readstreams - report an error
|