Back: Point-truncation and round off Up: Base classes Forward: PositionableStream class-instance creation   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.130 PositionableStream

Defined in namespace Smalltalk
Superclass: Stream
Category: Streams-Collections
My instances represent streams where explicit positioning is permitted. Thus, my streams act in a manner to normal disk files: you can read or write sequentially, but also position the file to a particular place whenever you choose. Generally, you'll want to use ReadStream, WriteStream or ReadWriteStream instead of me to create and use streams.

1.130.1 PositionableStream class: instance creation  (class)
1.130.2 PositionableStream: accessing-reading  (instance)
1.130.3 PositionableStream: class type methods  (instance)
1.130.4 PositionableStream: compiling  (instance)
1.130.5 PositionableStream: positioning  (instance)
1.130.6 PositionableStream: still unclassified  (instance)
1.130.7 PositionableStream: testing  (instance)
1.130.8 PositionableStream: truncating  (instance)


1.130.1 PositionableStream class: instance creation

on: aCollection
Answer an instance of the receiver streaming on the whole contents of aCollection

on: aCollection from: firstIndex to: lastIndex
Answer an instance of the receiver streaming from the firstIndex-th item of aCollection to the lastIndex-th


1.130.2 PositionableStream: accessing-reading

close
Disassociate a stream from its backing store.

contents
Returns a collection of the same type that the stream accesses, up to and including the final element.

copyFrom: start to: end
Answer the data on which the receiver is streaming, from the start-th item to the end-th. Note that this method is 0-based, unlike the one in Collection, because a Stream's #position method returns 0-based values.

next
Answer the next item of the receiver. Returns nil when at end of stream.

nextAvailable: anInteger into: aCollection startingAt: pos
Place up to anInteger objects from the receiver into aCollection, starting from position pos in the collection and stopping if no more data is available.

nextAvailable: anInteger putAllOn: aStream
Copy up to anInteger objects from the receiver into aStream, stopping if no more data is available.

peek
Returns the next element of the stream without moving the pointer. Returns nil when at end of stream.

peekFor: anObject
Returns true and gobbles the next element from the stream of it is equal to anObject, returns false and doesn't gobble the next element if the next element is not equal to anObject.

readStream
Answer a ReadStream on the same contents as the receiver

reverseContents
Returns a collection of the same type that the stream accesses, up to and including the final element, but in reverse order.


1.130.3 PositionableStream: class type methods

isExternalStream
We stream on a collection residing in the image, so answer false

species
Return the type of the collections returned by #upTo: etc., which are the same kind as those returned by the collection with methods such as #select:.


1.130.4 PositionableStream: compiling

name
Answer a string that represents what the receiver is streaming on

segmentFrom: startPos to: endPos
Answer an object that, when sent #asString, will yield the result of sending `copyFrom: startPos to: endPos' to the receiver


1.130.5 PositionableStream: positioning

basicPosition: anInteger
Move the stream pointer to the anInteger-th object

isPositionable
Answer true if the stream supports moving backwards with #skip:.

position
Answer the current value of the stream pointer

position: anInteger
Move the stream pointer to the anInteger-th object

reset
Move the stream back to its first element. For write-only streams, the stream is truncated there.

setToEnd
Move the current position to the end of the stream.

size
Answer the size of data on which we are streaming.

skip: anInteger
Move the current position by anInteger places, either forwards or backwards.


1.130.6 PositionableStream: still unclassified

nextPutAllOn: aStream
Write all the objects in the receiver to aStream.


1.130.7 PositionableStream: testing

atEnd
Answer whether the objects in the stream have reached an end

basicAtEnd
Answer whether the objects in the stream have reached an end. This method must NOT be overridden.

isEmpty
Answer whether the stream has no objects


1.130.8 PositionableStream: truncating

truncate
Truncate the receiver to the current position - only valid for writing streams



Back: PositionableStream-testing Up: PositionableStream Forward: Process   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on July, 23 2009 using texi2html