OsWritePipeStream
Description
A write pipe stream is a pipe stream that writes data to the writer side of the os pipe. This stream is used to stream data to a process via pipes and writes data in a blocking fashion.
Auto Flush
All write pipe streams support the concept of 'auto-flush' which is a policy to ensure data is flushed immediately to the os pipe and not queue it up in the smalltalk buffer. Users should not set that directly in <OsWritePipeStream>, but rather from #autoFlush methods or setting the OsProcessStarter>>tuneForInteractive policy.
Blocking API
This stream conforms to the majority of the smalltalk stream apis. Most of these will be considered blocking operations meaning that these methods can block the calling process. @see the methods in category IPC-API (Blocking)
Class Methods
None
Instance Methods
autoFlush
Answer true if this buffer will flush to the underlying os pipe after every write
Answers:
<Boolean>
autoFlush:
Sets a boolean indicating if the pipeBuffer will flush to the underlying
os pipe after every call to write
Arguments:
aBoolean - <Boolean>
flush
Flush all the data in the pipeBuffer to the underlying os pipe.
This will block if the os pipe is full
flush:
Perform the actions of @aBlock followed by a flush to the
subprocess stdin. autoFlush is disabled during this call to give the user
a chance to override the normal 'autoFlush on every write' behavior.
The autoFlush setting will be restored after this call.
This call can be useful for interactive contexts when communication with
a subprocess stdin should be very well controlled.
Arguments:
aBlock - 1-arg block passing in this stream
Answers:
<OsWritePipeStream> self
next:put:
Store argument @aByteOrChar @anInteger number of times.
If @anInteger < 1, then do not store any instances of @aByteOrChar
Fail if @anInteger is not a kind of Integer
Answers:
<Integer | Character> the input byte or char
nextPut:
Write @aByteOrChar to the pipe
Arguments:
aByteOrChar - <Integer | Character>
Answers:
<Integer | Character> byte or char
nextPutAll:
Write each element of @aByteCollection to the pipe
Arguments:
aByteCollection - <ByteArray>
Answers:
<ByteArray> - aByteCollection
nextPutAll:size:
Write @size elements from @aByteCollection beginning
at 1 to the pipe
Arguments:
aByteCollection - <ByteArray>
nextPutAll:startingAt:size:
Attempt to write @size bytes from the @aByteCollection starting
at the 1-based @startingIndex to the pipe
Arguments:
aByteCollection - <String | ByteArray> byte collection to write from
startingIndex - <SmallInteger> 1-based offset from @aByteCollection
size - <SmallInteger> number of bytes to attempt to write
Raises:
<OsProcessException>
nextPutLine:
Write each element of @aByteCollection to the pipe
followed by a line delimiter
Arguments:
aByteCollection - <ByteArray>
rawCr
Store the CR (carriage return) character as the next object in the
receiver. Answer self. Set the receiver's position reference to
be immediately after the CR character.
rawCrLf
Store the CrLf line delimiter as the next object in the
receiver. Answer self. Set the receiver's position reference to
be immediately after the CrLf character.
rawLf
Store the LF (line feed) character as the next object in the
receiver. Answer self. Set the receiver's position reference to
be immediately after the CF character.
space
Append a space to the output stream
tab
Append a tab to the output stream
Last modified date: 07/07/2022