|
Class: CharacterWriteStream
Object
|
+--Stream
|
+--PeekableStream
|
+--PositionableStream
|
+--WriteStream
|
+--CharacterWriteStream
|
+--TextStream
- Package:
- stx:libbasic
- Category:
- Streams
- Version:
- rev:
1.26
date: 2019/04/01 15:17:06
- user: cg
- file: CharacterWriteStream.st directory: libbasic
- module: stx stc-classLibrary: libbasic
- Author:
- Stefan Vogel (stefan@zwerg)
This is a WriteStream, which automagically changes the underlying collection,
if a character does not fit into the current collection
(i.e. String -> Unicode16String -> Unicode32Sting )
[instance variables:]
[class variables:]
String
Unicode16String
Unicode32Sting
instance creation
-
new
-
I know, that I operate on strings
-
new: count
-
I know, that I operate on strings
accessing
-
reset
-
reset the stream, to write again over the existing (or already written) contents.
See the comment in WriteStream>>contents
private
-
characterSizeChangedTo: newCharacterSize size: additionalSize
-
change aCollection to fit the size of newCharacterSize
private-accessing
-
on: aCollection
-
return a stream for writing into aCollection
-
on: aCollection from: start to: stop
-
return a stream for writing into part of aCollection.
This will position the stream to start writing at start-index,
and setup a writeLimit at stop-index.
Contents after stop-index will not be overwritten.
-
with: aCollection
-
return a stream for writing into aCollection.
This will position the stream to the end, and append written elements
after the initial contents.
I.e. the effect is similar to creating an empty stream first and then write
aCollection.
writing
-
next: count put: aCharacter
-
append anObject count times to the receiver.
Redefined to avoid count grows of the underlying collection -
instead a single grow on the final size is performed.
-
nextPut: aCharacter
-
append the argument, aCharacter to the stream.
Specially tuned for appending to String, Unicode16String and Unicode32String streams.
-
nextPutAll: aCollection
-
append aCollection to the receiver.
Redefined to convert to a string of the needed character size.
-
nextPutAll: aCollection startingAt: start to: stop
-
append the elements from first index to last index
of the argument, aCollection onto the receiver (i.e. both outstreams)
-
nextPutAllUnicode: aCollection
-
-
nextPutUnicode: aCharacter
-
|stream|
stream := CharacterWriteStream on:(String new:32).
stream nextPutAll:'abc'.
stream nextPut:(Character value:16r2c00).
stream contents inspect
|
|