eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'CharacterWriteStream':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: CharacterWriteStream


Inheritance:

   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)

Description:


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:]


Related information:

    String
    Unicode16String
    Unicode32Sting

Class protocol:

instance creation
o  new
I know, that I operate on strings

o  new: count
I know, that I operate on strings


Instance protocol:

accessing
o  reset
reset the stream, to write again over the existing (or already written) contents.
See the comment in WriteStream>>contents

private
o  characterSizeChangedTo: newCharacterSize size: additionalSize
change aCollection to fit the size of newCharacterSize

private-accessing
o  on: aCollection
return a stream for writing into aCollection

o  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.

o  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
o  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.

o  nextPut: aCharacter
append the argument, aCharacter to the stream.
Specially tuned for appending to String, Unicode16String and Unicode32String streams.

o  nextPutAll: aCollection
append aCollection to the receiver.
Redefined to convert to a string of the needed character size.

o  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)

o  nextPutAllUnicode: aCollection

o  nextPutUnicode: aCharacter


Examples:


    |stream|

    stream := CharacterWriteStream on:(String new:32).
    stream nextPutAll:'abc'.
    stream nextPut:(Character value:16r2c00).
    stream contents inspect


ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Fri, 29 Mar 2024 14:58:50 GMT