|
|
Class: Stream
Object
|
+--Stream
|
+--CollectingReadStream
|
+--Comanche::BufferStream
|
+--Comanche::DummyStream
|
+--CompressionStream
|
+--ConsStream
|
+--HashStream
|
+--JSONReader
|
+--PeekableStream
|
+--PrinterStream
|
+--RBScanner
|
+--Random
|
+--SelectingReadStream
|
+--SourceCodeStream
- Package:
- stx:libbasic
- Category:
- Streams
- Version:
- rev:
1.185
date: 2009/12/17 15:52:07
- user: stefan
- file: Stream.st directory: libbasic
- module: stx stc-classLibrary: libbasic
- Author:
- Claus Gittinger
An abstract class defining common behavior for all stream-like objects.
See concrete subclasses for more detail.
The protocol as implemented here is often only provided as a fallBack
for very uncommon cases. Much of it is redefined for performance.
(In streams which know more about their internal representation ...)
Subclasses should (at least) implement:
#next (if readable)
#nextPut: (if writable)
#contents
#atEnd
#isReadable
#isWritable
Peekable & Positionable streams should (at least) implement:
#peek
#position
#position:
[instance variables:]
signalAtEnd <nil | Boolean> controls behavior when a read
is attempted past the end-of-stream
if true, the endOfStreamSignal is raised.
if false, nil is returned.
if nil (the default), the signal
is raised, but if there is no handler,
nil is returned.
[Class variables / Exceptions:]
StreamError <Exception> parent of all stream errors
PositionError <Exception> position attemted on a stream
which does not support positioning,
or if the position is invalid.
ReadError <Exception> raised on read errors
WriteError <Exception> raised on write errors
EndOfStreamSignal <Signal> raised at end of stream if signalAtEnd
is enabled.
Signal constants
-
endOfStreamSignal
-
return the signal raised if read past end of stream is attemted
-
incompleteNextCountSignal
-
return the signal raised if not all requested elements are returned
-
lineTooLongErrorSignal
-
return the signal raised if a line is read which is too long (>32k)
-
positionErrorSignal
-
return the signal raised if positioning is requested for
a stream which does not support that kind of operation
-
readErrorSignal
-
return the signal raised on read errors
-
streamErrorSignal
-
return the parent of all stream errors;
handling this one also handles all other errors.
Also, this one may be raised for errors not related to read/write
operations, such as failed ioctls in externalStream etc.
-
writeErrorSignal
-
return the signal raised on write errors
constants
-
chunkSeparator
-
return the chunk-separation character
initialization
-
initSignals
-
-
initialize
-
instance creation
-
new
-
report an error - Streams are created using on:-messages
JS syntactic sugar
-
show: aString _: arg1
-
for JS easy syntax - allows: Transcript.show('format %1', arg1)
-
show: aString _: arg1 _: arg2
-
for JS easy syntax - allows: Transcript.show('format %1 %2', arg1, arg2)
-
show: aString _: arg1 _: arg2 _: arg3
-
for JS easy syntax - allows: Transcript.show('format %1 %2', arg1,...)
-
show: aString _: arg1 _: arg2 _: arg3 _: arg4
-
for JS easy syntax - allows: Transcript.show('format %1 %2', arg1,...)
-
show: aString _: arg1 _: arg2 _: arg3 _: arg4 _: arg5
-
for JS easy syntax - allows: Transcript.show('format %1 %2', arg1,...)
-
showCR: aString _: arg1
-
for JS easy syntax - allows: Transcript.showCR('format %1', arg1)
-
showCR: aString _: arg1 _: arg2
-
for JS easy syntax - allows: Transcript.showCR('format %1 %2', arg1, arg2)
-
showCR: aString _: arg1 _: arg2 _: arg3
-
for JS easy syntax - allows: Transcript.showCR('format %1 %2', arg1,...)
-
showCR: aString _: arg1 _: arg2 _: arg3 _: arg4
-
for JS easy syntax - allows: Transcript.showCR('format %1 %2', arg1,...)
-
showCR: aString _: arg1 _: arg2 _: arg3 _: arg4 _: arg5
-
for JS easy syntax - allows: Transcript.showCR('format %1 %2', arg1,...)
accessing
-
contents
-
return the entire contents of the stream.
For a readStream, that is the rest (i.e. upToEnd),
for a writeStream, that is the collected data. As we do not know here,
what we are, this is the responsibility of a subclass...
** This method raises an error - it must be redefined in concrete classes **
-
signalAtEnd
-
return the signalAtEnd flag setting.
If true, reading past the end will always raise an EndOfStream exception.
If false, no exception is raised and nil is returned from all reading messages.
If nil (default), the exception is raised if there is a handler; otherwise, nil is returned.
The default is nil (for ST80 compatibility) i.e. to only raise a signal if there is a handler.
-
signalAtEnd: aBoolean
-
set the signalAtEnd flag setting. If true, reading past the end
will raise an EndOfStream exception. If false, no exception is
raised and nil is returned from all reading messages.
The default is to raise a signal, but return nil if
not handled.
closing
-
close
-
close the stream - nothing done here.
Added for compatibility with external streams.
converting
-
asStream
-
emphasis
-
bold
-
set emphasis to #bold.
this allows Streams to be used interchangeable with printStreams
-
boldItalic
-
set emphasis to #boldItalic
this allows Streams to be used interchangeable with printStreams
-
emphasis
-
ignored here - allows Streams to be used interchangable with
text streams
-
emphasis: anEmphasis
-
ignored here.
this allows Streams to be used interchangeable with printStreams
-
italic
-
set emphasis to #italic.
this allows Streams to be used interchangeable with printStreams
-
normal
-
set emphasis to #normal.
this allows Streams to be used interchangeable with printStreams
-
strikeout
-
set emphasis to #strikeout.
this allows Streams to be used interchangeable with printStreams
-
underline
-
set emphasis to #underline.
this allows Streams to be used interchangeable with printStreams
enumerating
-
do: aBlock
-
evaluate the argument, aBlock for all remaining elements,
up to the end of the stream
-
linesDo: aBlock
-
evaluate the argument, aBlock for all lines,
up to the end of the stream
error handling
-
checkNilFileStream
-
Do nothing if this is a valid FileStream
(i.e. the previous open operation was successful).
Also implemented in UndefinedObject, to raise an Error there.
This is an aid for converting from the old error reporting (returning nil)
to the new error reporting (with real Exceptions).
It will vanish as soon as the conversion has been done
-
pastEnd
-
someone tried to read after the end of the stream.
If signalAtEnd == true, raise a signal. If its false, return nil.
Otherwise raise the signal, but only if handled; otherwise return nil.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
pastEndRead
-
someone tried to read after the end of the stream.
If signalAtEnd == true, raise a signal.
If it is false, return nil.
Otherwise raise a notification, which is ignored if not handled;
otherwise return nil.
misc
-
binary
-
switch to binary mode. In binary mode, reading of text streams
returns byte-valued integers instead of characters; writing expects
byte-valued integers respectively.
Ignored here, but added to make internalStreams protocol compatible
with externalStreams.
-
blocking: aBoolean
-
set non-blocking mode.
Ignored, since internal streams never block
-
eolMode: aSymbol
-
Ignored here, but added to make internalStreams protocol compatible
with externalStreams.
-
lineEndCRLF
-
Ignored here, but added to make internalStreams protocol compatible
with externalStreams.
-
lineEndTransparent
-
Ignored here, but added to make internalStreams protocol compatible
with externalStreams.
-
text
-
switch to text mode.
Ignored here, but added to make internalStreams protocol compatible
with externalStreams.
misc functions
-
copy: numberOfBytes into: outStream bufferSize: bufferSize
-
read from the receiver, and write all data up to count or the end to another stream.
Return the number of bytes which have been transferred
-
copyToEndFrom: inStream
-
read from inStream, and write all data up to the end to the receiver.
Return the number of bytes which have been transferred.
Same functionality as copyToEnd:, but reversed arg and receiver
(useful in a cascade message of the writeStream)
-
copyToEndInto: outStream
-
read from the receiver, and write all data up to the end to another stream.
Return the number of bytes which have been transferred
-
copyToEndInto: outStream bufferSize: bufferSize
-
read from the receiver, and write all data up to the end to another stream.
Return the number of bytes which have been transferred
non homogenous reading
-
nextAvailableBytes: numBytes into: aCollection startingAt: initialIndex
-
for compatibility with ExternalStream
-
nextByte
-
return the next byte of the stream
- we do not know here how to do it, it should be redefined in subclass
-
nextBytes: count
-
read the next count bytes and return it as a byteArray.
If EOF is encountered while reading, a truncated byteArray is returned.
If EOF is already reached before the first byte can be read,
nil is returned.
-
nextBytes: count into: anObject
-
read the next count bytes into an object and return the number of
bytes read. On EOF, 0 is returned.
If the receiver is some socket/pipe-like stream, an exception
is raised if the connection is broken.
The object must have non-pointer indexed instvars (i.e. it must be
a ByteArray, String, Float- or DoubleArray).
If anObject is a string or byteArray and reused, this provides the
fastest possible physical I/O (since no new objects are allocated).
Use with care - non object oriented i/o.
Warning: in general, you cannot use this method to pass data from other
architectures since it does not care for byte order or float representation.
-
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.
-
nextBytes: numBytes into: aCollection startingAt: initialIndex blockSize: blockSize
-
like nextBytes:into:startingAt:, but read in blocks of the given size.
This leads to better beahvior when reading large chunks from a slow device,
such as a cdrom drive (since a single unix-read is not interruptable).
-
nextBytesInto: anObject
-
read bytes into an object, regardless of binary/text mode.
The number of bytes to read is defined by the objects size.
Return the number of bytes read. On EOF, 0 is returned.
If the receiver is some socket/pipe-like stream, an exception
is raised if the connection is broken.
The object to read into must have non-pointer indexed instvars
(i.e. it must be a ByteArray, String, Float- or DoubleArray).
If anObject is a string or byteArray and reused, this provides the
fastest possible physical I/O (since no new objects are allocated).
Use with care - non object oriented i/o.
Warning: in general, you cannot use this method to pass data from other
architectures since it does not care for byte order or float representation.
-
nextHyperMSB: msbFlag
-
return a signed hyper (8 bytes) from the stream.
The receiver must support reading of binary bytes.
The msbFlag argument controls if the integer is to be read with
most-significant-byte-first (true) or least-first (false).
This interface is provided to allow talking to external programs,
where its known that the byte order is some definite one.
If you dont care (i.e. talk to other smalltalks) or you can control the
order, please use the corresponding xxxNet methods, which use a standard
network byte order.
-
nextIEEEDouble
-
read an 8-byte IEEE double precision float number
-
nextIEEESingle
-
read a 4-byte IEEE single precision float number
-
nextLongMSB: msbFlag
-
return a signed long (4 bytes) from the stream.
The receiver must support reading of binary bytes.
The msbFlag argument controls if the integer is to be read with
most-significant-byte-first (true) or least-first (false).
This interface is provided to allow talking to external programs,
where its known that the byte order is some definite one.
If you dont care (i.e. talk to other smalltalks) or you can control the
order, please use the corresponding xxxNet methods, which use a standard
network byte order.
-
nextLongNet
-
return a signed long (4 bytes) in network byte order from the stream.
The receiver must support reading of binary bytes.
-
nextNumber: numBytes
-
Return the next n bytes as a positive Integer; bytes are taken msb-first.
-
nextShortMSB: msbFlag
-
return a signed short (2 bytes) from the stream.
The receiver must support reading of binary bytes.
The msbFlag argument controls if the integer is to be read with
most-significant-byte-first (true) or least-first (false).
This interface is provided to allow talking to external programs,
where its known that the byte order is some definite one.
If you dont care (i.e. talk to other smalltalks) or you can control the
order, please use the corresponding xxxNet methods, which use a standard
network byte order.
-
nextShortNet
-
return a signed short (2 bytes) in network byte order from the stream.
The receiver must support reading of binary bytes.
Network byte order is MSB per definition
-
nextSignedByte
-
return a signed byte (-128..127) from the stream.
The receiver must support reading of binary bytes.
-
nextUnsigned: numBytes MSB: msbFlag
-
return a numBytes-sized unsigned (numBytes bytes) from the stream as an Integer.
The receiver must support reading of binary bytes.
The msbFlag argument controls if the integer is to be read with
most-significant-byte-first (true) or least-first (false).
This interface is provided to allow talking to external programs,
where its known that the byte order is some definite one.
If you dont care (i.e. talk to other smalltalks) or you can control the
order, please use the corresponding xxxNet methods, which use a standard
network byte order.
-
nextUnsignedHyperMSB: msbFlag
-
return an unsigned hyper (8 bytes) from the stream.
The receiver must support reading of binary bytes.
The msbFlag argument controls if the integer is to be read with
most-significant-byte-first (true) or least-first (false).
This interface is provided to allow talking to external programs,
where its known that the byte order is some definite one.
If you dont care (i.e. talk to other smalltalks) or you can control the
order, please use the corresponding xxxNet methods, which use a standard
network byte order.
-
nextUnsignedLongMSB: msbFlag
-
return an unsigned long (4 bytes) from the stream.
The receiver must support reading of binary bytes.
The msbFlag argument controls if the integer is to be read with
most-significant-byte-first (true) or least-first (false).
This interface is provided to allow talking to external programs,
where its known that the byte order is some definite one.
If you dont care (i.e. talk to other smalltalks) or you can control the
order, please use the corresponding xxxNet methods, which use a standard
network byte order.
-
nextUnsignedLongNet
-
return an unsigned long (4 bytes) in network byte order from the stream.
The receiver must support reading of binary bytes.
-
nextUnsignedShortMSB: msbFlag
-
return an unsigned short (2 bytes) from the stream.
The receiver must support reading of binary bytes.
The msbFlag argument controls if the integer is to be read with
most-significant-byte-first (true) or least-first (false).
This interface is provided to allow talking to external programs,
where its known that the byte order is some definite one.
If you dont care (i.e. talk to other smalltalks) or you can control the
order, please use the corresponding xxxNet methods, which use a standard
network byte order.
-
nextUnsignedShortNet
-
return an unsigned short (2 bytes) in network byte order from the stream.
The receiver must support reading of binary bytes.
Network byte order is MSB per definition
non homogenous writing
-
nextLongPut: aNumber
-
for ST-80 compatibility:
Write the argument, aNumber as a long (four bytes).
The most significant byte is sent first.
-
nextNumber: n put: v
-
Append to the receiver the argument, v, which is a positive Integer,
as the next n bytes. Bytes are written msb first.
Possibly pad with leading zeros.
The receiver must support writing of binary bytes.
-
nextPutAllUtf8: aString
-
normal streams can not handle multi-byte characters, so convert them to utf8
-
nextPutByte: aByteValue
-
write a byte.
Same as nextPut: here; for protocol compatibility with externalStream.
-
nextPutBytes: anObject
-
write bytes from an object; the number of bytes is defined by
the objects size.
Return the number of bytes written or nil on error.
The object must have non-pointer indexed instvars
(i.e. be a ByteArray, String, Float- or DoubleArray).
Use with care - non object oriented i/o.
Warning: in general, you cannot use this method to pass non-byte data to other
architectures since it does not care for byte order or float representation.
-
nextPutBytes: count from: anObject
-
write count bytes from an object.
Return the number of bytes written or nil on error.
The object must have non-pointer indexed instvars
(i.e. be a ByteArray, String, Float- or DoubleArray).
Use with care - non object oriented i/o.
Warning: in general, you cannot use this method to pass non-byte data to other
architectures since it does not care for byte order or float representation.
-
nextPutBytes: count from: anObject startingAt: start
-
write count bytes from an object starting at index start.
Return the number of bytes written.
The object must have non-pointer indexed instvars
(i.e. be a ByteArray, String, Float- or DoubleArray).
Use with care - non object oriented i/o.
This is provided for compatibility with externalStream;
to support binary storage
-
nextPutBytesFrom: anObject
-
write bytes from an object; the number of bytes is defined by the objects size.
Return the number of bytes written or nil on error.
The object must have non-pointer indexed instvars
(i.e. be a ByteArray, String, Float- or DoubleArray).
Use with care - non object oriented i/o.
Warning: in general, you cannot use this method to pass non-byte data to other
architectures since it does not care for byte order or float representation.
-
nextPutHyper: aNumber MSB: msbFlag
-
Write the argument, aNumber as a hyper (8 bytes).
If msbFlag is true, data is written most-significant byte first;
otherwise least first.
Returns the receiver on ok, nil on error.
The receiver must support writing of binary bytes.
This interface is provided to allow talking to external programs,
where its known that the byte order is some definite one.
If you dont care (i.e. talk to other smalltalks) or you can control the
order, please use the corresponding xxxNet methods, which use a standard
network byte order.
-
nextPutIEEEDouble: aFloat
-
write an 8-byte IEEE double precision float number
-
nextPutIEEESingle: aFloat
-
write a 4-byte IEEE single precision float number
-
nextPutLong: aNumber MSB: msbFlag
-
Write the argument, aNumber as a long (four bytes).
If msbFlag is true, data is written most-significant byte first;
otherwise least first.
Returns the receiver on ok, nil on error.
The receiver must support writing of binary bytes.
This interface is provided to allow talking to external programs,
where its known that the byte order is some definite one.
If you dont care (i.e. talk to other smalltalks) or you can control the
order, please use the corresponding xxxNet methods, which use a standard
network byte order.
-
nextPutLongNet: aNumber
-
Write the argument, aNumber as a long (four bytes) in the network byte order.
Returns the receiver on ok, nil on error.
The receiver must support writing of binary bytes.
-
nextPutShort: aNumber MSB: msbFlag
-
Write the argument, aNumber as a short (two bytes).
If msbFlag is true, data is written most-significant byte first;
otherwise least first.
Returns the receiver on ok, nil on error.
The receiver must support writing of binary bytes.
This interface is provided to allow talking to external programs,
where its known that the byte order is some definite one.
If you dont care (i.e. talk to other smalltalks) or you can control the
order, please use the corresponding xxxNet methods, which use a standard
network byte order.
-
nextPutShortNet: aNumber
-
Write the argument, aNumber as a short (two bytes) in the network byte order.
Returns the receiver on ok, nil on error.
The receiver must support writing of binary bytes.
Network byte order is MSB per definition
-
nextPutUtf8: aCharacter
-
append my UTF-8 representation to the argument, aStream.
Up to 31 bits can be encoded in up to 6 bytes.
However, currently, characters are limited to 16 bits.
-
nextPutWord: aNumber
-
write the argument, aNumber as a signed short (two bytes);
write msb-first for compatibility with other smalltalks.
The receiver must support writing of binary bytes.
I dont know if it should be named nextPutWord: or nextWordPut:;
one of them will vanish ...
-
nextShortPut: aNumber MSB: msbFlag
-
for backward compatibility - this will vanish
-
nextTwoBytesPut: anInteger
-
Write anInteger as the next two bytes of the
receiver stream.
-
nextWordPut: aNumber
-
for ST-80 compatibility:
Write the argument, aNumber as a short (two bytes).
The most significant byte is sent first.
private
-
contentsSpecies
-
this should return the class of which an instance is
returned by the #contents method. Here, Array is returned,
since the abstract Stream-class has no idea of the underlying
collection class.
It is redefined in some subclasses - for example, to return String.
queries
-
isBinary
-
return true, if in binary mode. Always returns false here,
to make internalStreams protocol compatible with externalStreams.
-
isOpen
-
for compatibility with externalStream:
return true, if this stream is open.
-
isPositionable
-
return true, if the stream supports positioning (some do not).
Since this is an abstract class, false is returned here - just to make certain.
-
isPrinterStream
-
return true, if this is a printerStream.
Since this is an abstract class, false is returned here.
-
isReadable
-
return true, if reading is supported by the recevier.
This has to be redefined in concrete subclasses.
** This method raises an error - it must be redefined in concrete classes **
-
isStream
-
return true, if the receiver is some kind of Stream. Always return true here.
-
isTerminalStream
-
-
isWritable
-
return true, if writing is supported by the recevier.
This has to be redefined in concrete subclasses.
** This method raises an error - it must be redefined in concrete classes **
-
lineLength
-
return the lineLength which `looks good' when pretty printed
text is sent to this stream.
This has NO meaning whatsoever to regular streams;
however, it may be used as a layout hint for prettyprinting functions
- for compatibility with TextCollectors, which returns its views actual
line length, and allows the prettyprinter to wrap at that position.
-
lineNumber
-
return the current lineNumber if known
-
numberOfTerminalCols
-
-
numberOfTerminalLines
-
-
pageFormat
-
return the pageFormat - nil here.
This has NO meaning whatsoever to regular streams;
however, it has been added for protocol compatibility with printerStreams
-
terminalType
-
reading
-
next
-
return the next element of the stream
- we do not know here how to do it, it must be redefined in subclass
** This method raises an error - it must be redefined in concrete classes **
-
next: count
-
return the next count elements of the stream as aCollection,
which depends on the streams type - (see #contentsSpecies).
-
next: count into: aWriteStream
-
put the next count elements of the stream into aWriteStream
-
nextAvailable: count
-
return the next count elements of the stream as aCollection.
If the stream reaches the end before count elements have been read,
return what is available. (i.e. a shorter collection).
The type of collection is specified in #contentsSpecies.
-
nextMatchFor: anObject
-
read an element from the receiver, return true if it was equal to
the argument, anObject; false otherwise.
-
nextOrNil
-
like #next, this returns the next element, if available.
If nothing is available, this does never raise a read-beyond end signal.
Instead, nil is returned immediately.
-
skip: numberToSkip
-
skip numberToSkip objects, return the receiver
-
skipFor: anObject
-
skip all objects up-to and including anObject;
return the element after anObject.
-
skipLine
-
read the next line (characters up to newline) skip only;
return nil if EOF reached, self otherwise.
Not allowed in binary mode.
-
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.
The next read operation will return the element after anObject.
-
skipThroughAll: aCollection
-
skip for and through the sequence given by the argument, aCollection;
return nil if not found, the receiver otherwise.
On a successful match, the next read will return elements after aCollection;
if no match was found, the receiver will be positioned at the end.
-
through: anObject
-
read a collection of all objects up-to anObject and return these
elements, including anObject.
The next read operation will return the element after anObject.
If anObject is not encountered, all elements up to the end are read
and returned.
Compare this with #upTo: which also reads up to some object
and also positions behind it, but does not include it in the returned
value.
-
throughAll: aCollection
-
read & return a collection of all objects up-to and including
a subcollection given by aCollection.
(i.e. read until a ``substring'' is encountered.)
The next read operation will return the element after aCollection.
If aCollection is not encountered, all elements up to the end are read
and returned.
-
throughAny: aCollection
-
read & return a collection of all objects up-to and including
an element contained in aCollection.
(i.e. read until any from aCollection is encountered.)
If no such character is encountered, all elements up to the end are read
and returned.
-
upTo: anObject
-
read a collection of all objects up-to anObject and return these
elements, but excluding anObject.
The next read operation will return the element after anObject.
(i.e. anObject is considered a separator, which is skipped)
Similar to #through:, but the matching object is not included in the
returned collection.
If anObject is not encountered, all elements up to the end are read
and returned.
Compare this with #through: which also reads up to some object
and also positions behind it, but DOES include it in the returned
value.
-
upTo: anObject into: aStream
-
read a collection of all objects up-to anObject and append these
elements to aStream, but excluding anObject.
The next read operation will return the element after anObject.
(i.e. anObject is considered a separator, which is skipped)
Similar to #through:, but the matching object is not included in the returned collection.
If anObject is not encountered, all elements up to the end are read and returned.
Compare this with #through: which also reads up to some object
and also positions behind it, but DOES include it in the returned value.
-
upToAllExcluding: aCollection
-
read a collection of all objects up-to a element which is contained in
aCollection and return these elements, but excluding the matching one.
The next read operation will return the element after aCollection.
If no such element is encountered, all elements up to the end are read
and returned.
See also #throughAll: which also reads up to some object
and also positions behind it, but DOES include it in the returned
value.
See also #upToAll:, which returns the same, but leaves the
read pointer before the matched subcollection.
-
upToAny: aCollectionOfObjects
-
read a collection of all objects up-to a element which is contained in
aCollectionOfObjects and return these elements, but excluding the matching one.
The next read operation will return the element after anObject.
If no such element is encountered, all elements up to the end are read
and returned.
Compare this with #throughAll: which also reads up to some object
and also positions behind it, but DOES include it in the returned
value.
-
upToBeforeAny: aCollectionOfObjects
-
read a collection of all objects up-to a element which is contained in
aCollectionOfObjects and return these elements, but excluding the matching one.
The next read operation will return the matching element.
If no such element is encountered, all elements up to the end are read
and returned.
This returns the exact same as upToAny: would, but leaves the streams position so that
the next read returns the matching delimiter instead of skipping it.
Caveat: this is the one which should have been called upTo: in the first place;
however, it seems now too late for a change.
-
upToEnd
-
return a collection of the elements up-to the end.
Return an empty collection, if the stream-end is already at the end.
reading-strings
-
nextLine
-
return the characters upTo (but excluding) the next cr (carriage return)
character (i.e. read a single line of text).
Added for protocol compatibility with externalStreams.
stacked computing streams
-
collecting: aBlock
-
return a stacked computing stream, which reads elements from the receiver,
applies aBlock to each read element, and provides the results as elements to its reader.
-
selecting: aBlock
-
return a stacked computing stream, which reads elements from the receiver,
but only provides elements for which aBlock returns true to its reader.
testing
-
atEnd
-
return true if the end of the stream has been reached;
- we do not know here how to do it, it must be redefined in subclass
** This method raises an error - it must be redefined in concrete classes **
-
isEmpty
-
return true, if the contents of the stream is empty
** This method raises an error - it must be redefined in concrete classes **
-
notEmpty
-
return true, if the contents of the stream is not empty
visiting
-
acceptVisitor: aVisitor with: aParameter
-
waiting for I/O
-
readWait
-
suspend the current process, until the receiver
becomes ready for reading. If data is already available,
return immediate.
The other threads are not affected by the wait.
-
readWaitTimeoutMs: timeout
-
ST-80 compatibility
-
readWaitWithTimeout: seconds
-
suspend the current process, until the receiver
becomes ready for reading or a timeout (in seconds) expired.
If data is already available, return immediate.
With nil seconds, wait forever.
Return true if a timeout occured (i.e. false, if data is available).
The other threads are not affected by the wait.
-
readWaitWithTimeoutMs: millis
-
suspend the current process, until the receiver
becomes ready for reading or a timeout (in milliseconds) expired.
If data is already available, return immediate.
With nil millis, wait forever.
Return true if a timeout occured (i.e. false, if data is available).
The other threads are not affected by the wait.
-
readWriteWait
-
suspend the current process, until the receiver
becomes ready for writing or reading.
Return immediate if the receiver is already ready.
The other threads are not affected by the wait.
-
readWriteWaitWithTimeoutMs: millis
-
-
writeWait
-
suspend the current process, until the receiver
becomes ready for writing.
Return immediate if the receiver is already ready.
The other threads are not affected by the wait.
-
writeWaitTimeoutMs: timeout
-
ST-80 compatibility
-
writeWaitWithTimeout: timeout
-
suspend the current process, until the receiver
becomes ready for writing or a timeout (in seconds) expired.
Return true if a timeout occured (i.e. false, if data is available).
Return immediate if the receiver is already ready.
The other threads are not affected by the wait.
-
writeWaitWithTimeoutMs: millis
-
writing
-
commit
-
alias for flush -- ST80 compatibility
-
cr
-
append a carriage-return to the stream.
This is only allowed, if the receiver supports writing.
-
crTab
-
append a carriage-return followed by a tab to the stream.
Same as crtab for ST/X backward compatibility.
This is only allowed, if the receiver supports writing.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
crlf
-
append a CR LF to the stream.
This is only allowed, if the receiver supports writing.
-
crtab
-
append a carriage-return followed by a tab to the stream.
This is only allowed, if the receiver supports writing.
-
crtab: n
-
append a carriage-return followed by n tabs to the stream.
This is only allowed, if the receiver supports writing.
-
endEntry
-
ignored here - for compatibility with Transcript
-
ff
-
append a form-feed (new-pagee) to the receiver-stream.
This is only allowed, if the receiver supports writing.
-
flush
-
write out all unbuffered data - ignored here, but added
to make internalStreams protocol compatible with externalStreams
-
next: count put: anObject
-
put the argument, anObject count times onto the receiver.
This is only allowed, if the receiver supports writing.
-
nextPut: anObject
-
put the argument, anObject onto the receiver
- we do not know here how to do it, it must be redefined in subclass
** This method raises an error - it must be redefined in concrete classes **
-
nextPutAll: aCollection
-
put all elements of the argument, aCollection onto the receiver.
This is only allowed, if the receiver supports writing.
-
nextPutAll: aCollection startingAt: first
-
append the elements starting with index to the end
of the argument, aCollection onto the receiver.
This is only allowed, if the receiver supports writing.
-
nextPutAll: aCollection startingAt: first to: last
-
append the elements with index from first to last
of the argument, aCollection onto the receiver.
This is only allowed, if the receiver supports writing.
-
nextPutAllText: aText
-
normal streams can not handle text/emphasis, so convert aText to the string
-
nextPutAllUnicode: aString
-
normal streams can not handle multi-byte characters, so convert them to utf8
-
nextPutAllUntranslated: aCollection
-
for compatibility with printStreams (putAll - as-is without escapes)
-
nextPutLine: aCollection
-
put all elements of the argument, aCollection onto the receiver,
and append a cr (carriage return).
This is only useful with character streams in textMode,
and only allowed, if the receiver supports writing.
-
nextPutUnicode: aCharacter
-
normal streams can not handle multi-byte characters, so convert them to utf8
-
print: anObject
-
append a printed representation of anObject to the receiver.
Same as 'anObject printOn:self'; Added for ST-80 compatibility.
-
show: something
-
append a printed representation of the argument to the stream.
This makes streams somewhat compatible to TextCollectors and
allows you to say:
Smalltalk at:#Transcript put:Stdout
or to use #show:/#showCR: with internal or external streams.
-
show: something with: arg
-
append a printed representation of the argument to the stream, expanding
the placeHolder %1 with the printString of arg.
This makes streams somewhat compatible to TextCollectors and
allows you to say:
Smalltalk at:#Transcript put:Stdout
or to use #show:/#showCR: with internal or external streams.
-
show: something with: arg1 with: arg2
-
append a printed representation of the argument to the stream, expanding
the placeHolders %1 and %2 with the printStrings of arg1 and arg2.
This makes streams somewhat compatible to TextCollectors and
allows you to say:
Smalltalk at:#Transcript put:Stdout
or to use #show:/#showCR: with internal or external streams.
-
show: something with: arg1 with: arg2 with: arg3
-
append a printed representation of the argument to the stream, expanding
the placeHolders %1,%2 and %3 with the printStrings of arg1, arg2 and arg3.
This makes streams somewhat compatible to TextCollectors and
allows you to say:
Smalltalk at:#Transcript put:Stdout
or to use #show:/#showCR: with internal or external streams.
-
showCR: aString
-
append a printed representation of the argument to the stream
and append a newline character.
This makes streams somewhat compatible to TextCollectors and
allows you to say:
Smalltalk at:#Transcript put:Stdout
or to use #show:/#showCR: with internal or external streams.
-
showCr: aString
-
append a printed representation of the argument to the stream
and append a newline character.
This is obsolete ST/X backward compatibility; use #showCR:
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
space
-
append a space character to the receiver.
This is only allowed, if the receiver supports writing.
-
spaces: count
-
append count space-characters to the receiver.
This is only allowed, if the receiver supports writing.
-
store: anObject
-
append a printed representation of anObject to the receiver,
from which the receiver can be reconstructed (i.e. its storeString).
Same as 'anObject storeOn:self'; Added for ST-80 compatibility.
-
sync
-
write out all unbuffered data - ignored here, but added
to make internalStreams protocol compatible with externalStreams
-
syncData
-
write out all unbuffered data - ignored here, but added
to make internalStreams protocol compatible with externalStreams
-
tab
-
append a tab-character to the stream.
This is only allowed, if the receiver supports writing.
-
tab: count
-
append count tab-characters to the receiver.
This is only allowed, if the receiver supports writing.
writing-chunks
-
nextChunkPut: aString
-
put aString as a chunk onto the receiver;
double all exclamation marks except within primitives and append a
single delimiting exclamation mark at the end.
This modification of the chunk format (not doubling exclas in primitive code)
was done to have primitive code more readable and easier be edited in the fileBrowser
or other editors.
Its no incompatibility, since inline primitives are an ST/X special
and code containing ST/X primitives cannot be loaded into other smalltalks anyway.
-
nextPutAllAsChunk: aString
-
put aString as a chunk onto the receiver;
double all exclamation marks except within primitives.
This modification of the chunk format (not doubling exclas in primitive code)
was done to have primitive code more readable and easier be edited in the fileBrowser
or other editors.
Its no incompatibility, since inline primitives are an ST/X special
and code containing ST/X primitives cannot be loaded into other smalltalks anyway.
-
nextPutChunkSeparator
-
append a chunk separator character
|