smalltalk
/
osmo-st-all
Archived
1
0
Fork 0
This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
osmo-st-all/grease/Core/Text/GRNullCodecStream.st

38 lines
966 B
Smalltalk

GRCodecStream subclass: GRNullCodecStream [
<comment: 'A WANullCodecStream is a WriteStream on a String on which you can both put binary and character data without encoding happening.
Instance Variables
stream: <WriteStream>
stream
- a WriteStream on a String'>
<category: 'Grease-Core-Text'>
next [
<category: 'streaming'>
^stream next
]
next: anInteger [
<category: 'streaming'>
^stream next: anInteger
]
nextPut: aCharacterOrByte [
<category: 'streaming'>
aCharacterOrByte isCharacter
ifTrue: [stream nextPut: aCharacterOrByte]
ifFalse: [stream nextPut: (Character value: aCharacterOrByte)]
]
nextPutAll: aStringOrByteArray [
<category: 'streaming'>
aStringOrByteArray isString
ifTrue: [stream nextPutAll: aStringOrByteArray]
ifFalse: [1
to: aStringOrByteArray size
do: [:index | stream nextPut: (Character value: (aStringOrByteArray at: index))]]
]
]