|
|
6.132 Stream
- Defined in namespace Smalltalk
- Category: Streams
- I am an abstract class that provides interruptable sequential access to
objects. I can return successive objects from a source, or accept
successive objects and store them sequentially on a sink. I provide
some simple iteration over the contents of one of my instances, and
provide for writing collections sequentially.
6.132.1 Stream: accessing-reading
- contents
- Answer the whole contents of the receiver, from the next object to the last
- next
- Return the next object in the receiver
- next: anInteger
- Return the next anInteger objects in the receiver
- nextAvailable: anInteger
- Return up to anInteger objects in the receiver, stopping if the end of the stream is reached
- nextMatchFor: anObject
- Answer whether the next object is equal to anObject. Even if it does not, anObject is lost
- splitAt: anObject
- Answer an OrderedCollection of parts of the receiver. A new (possibly empty) part starts at the start of the receiver, or after every occurrence of an object which is equal to anObject (as compared by #=).
6.132.2 Stream: accessing-writing
- next: anInteger put: anObject
- Write anInteger copies of anObject to the receiver
- nextPut: anObject
- Write anObject to the receiver
- nextPutAll: aCollection
- Write all the objects in aCollection to the receiver
6.132.3 Stream: basic
- species
- Answer `Array'.
6.132.4 Stream: character writing
- cr
- Store a cr on the receiver
- crTab
- Store a cr and a tab on the receiver
- nl
- Store a new line on the receiver
- nlTab
- Store a new line and a tab on the receiver
- space
- Store a space on the receiver
- space: n
- Store n spaces on the receiver
- tab
- Store a tab on the receiver
- tab: n
- Store n tabs on the receiver
6.132.5 Stream: enumerating
- do: aBlock
- Evaluate aBlock once for every object in the receiver
6.132.6 Stream: filing out
- fileOut: aClass
- File out aClass on the receiver. If aClass is not a metaclass, file out class and instance methods; if aClass is a metaclass, file out only the class methods
6.132.7 Stream: PositionableStream methods
- nextLine
- Returns a collection of the same type that the stream accesses, up to but not including the object anObject. Returns the entire rest of the stream's contents if anObject is not present.
- skip: anInteger
- Move the position forwards by anInteger places
- skipTo: anObject
- Move the current position to after the next occurrence of anObject and return true if anObject was found. If anObject doesn't exist, the pointer is atEnd, and false is returned.
- skipToAll: aCollection
- If there is a sequence of objects remaining in the stream that is equal to the sequence in aCollection, set the stream position just past that sequence and answer true. Else, set the stream position to its end and answer false.
- upTo: anObject
- Returns a collection of the same type that the stream accesses, up to but not including the object anObject. Returns the entire rest of the stream's contents if anObject is not present.
- upToAll: aCollection
- If there is a sequence of objects remaining in the stream that is equal to the sequence in aCollection, set the stream position just past that sequence and answer the elements up to, but not including, the sequence. Else, set the stream position to its end and answer all the remaining elements.
- upToEnd
- Answer every item in the collection on which the receiver is streaming, from the next one to the last
6.132.8 Stream: printing
- << anObject
- This method is a short-cut for #display:; it prints anObject on the receiver by sending displayOn: to anObject. This method is provided so that you can use cascading and obtain better-looking code
- display: anObject
- Print anObject on the receiver by sending displayOn: to anObject. This method is provided so that you can use cascading and obtain better-looking code
- print: anObject
- Print anObject on the receiver by sending printOn: to anObject. This method is provided so that you can use cascading and obtain better-looking code
6.132.9 Stream: providing consistent protocols
- close
- Do nothing. This is provided for consistency with file streams
- flush
- Do nothing. This is provided for consistency with file streams
6.132.10 Stream: storing
- store: anObject
- Print Smalltalk code compiling to anObject on the receiver, by sending storeOn: to anObject. This method is provided so that you can use cascading and obtain better-looking code
6.132.11 Stream: testing
- atEnd
- Answer whether the stream has got to an end
|