OsPipeStreamBuffer
Description
An internal class used as the buffer implementation for bytes to and from os processes
Class Methods
<details> defaultSize
<pre><code> Answer the default size of this buffer.
Answers:
<Integer>
</code></pre> </details>
<details> maxSize
<pre><code> Answer the maximum size of an buffer. This value is based on the offset constraints of OSObject's
Answers:
<Integer>
</code></pre> </details>
<details> new
<pre><code> Answer a new buffer that uses a default size
Answers:
<OsPipeStreamBuffer>
</code></pre> </details>
<details> new:
<pre><code> Answer a new byte buffer of size @aSize
Arguments:
aSize - Size of the buffer to allocate
Answers:
<OsPipeStreamBuffer>
</code></pre> </details>
<details> new:isBytes:
<pre><code> Answer a new buffer of size @aSize Factory method: If @aSize is beyond the limits of an OsPipeStreamBuffer
Arguments:
aSize - Size of the buffer to allocate
aBoolean - true if buffer is bytes, false for chars
Answers:
<OsPipeStreamBuffer>
</code></pre> </details>
Instance Methods
<details> allocate:
<pre><code> Allocate additional allocated bytes into the buffer
Arguments:
anInteger - <Integer> num bytes to move the allocation end offset forward
</code></pre> </details>
<details> allocateAll
Allocate the remaining unallocated space
</details>
<details> allocated
<pre><code> Answer the number of allocated bytes in the buffer
Answers:
<Integer>
</code></pre> </details>
<details> atEnd
<pre><code> Answer true if the current position ptr offset is the same as the end offset
Answers:
<Boolean>
</code></pre> </details>
<details> atEndAndIsFull
<pre><code> Buffer reset is required if there is nothing further that can be read from the buffer AND there is no additional allocatable space
Answers:
<Boolean>
</code></pre> </details>
<details> consumable
<pre><code> Answer the number of consumable bytes remaining in the buffer
Answers:
<Integer>
</code></pre> </details>
<details> consume:
<pre><code> Consume the buffer bytes by repositioning the current pointer
Arguments:
anInteger - <Integer> num bytes to move forward
</code></pre> </details>
<details> consumeAll
Consume all by setting the position offset to the end offset
</details>
<details> consumed
<pre><code> Answer the number of bytes consumed in the buffer
Answers:
<Integer>
</code></pre> </details>
<details> exceptionClass:
</details>
<details> flush:into:size:startingAt:
<pre><code> Fill up the @aByteCollection starting at @anIndex using the bytes from the internal buffer and move the cursor forward to make what was copied inaccessible
Arguments:
numBytes - <Integer> number of bytes to copy to aByteCollection
aByteCollection - <ByteArray | String | OSObject>
aSize - <Integer> size of the byte collection
anIndex - <Integer> first 0-based index in aByteCollection to copy bytes to
Answers:
<Integer> the number of bytes written to the collection
</code></pre> </details>
<details> grow
<pre><code> Dynamically grow the buffer such that the required amount of unallocated space is the size of the buffer. This will double the size of the buffer if the unallocated amount has fallen to 0.
Answers:
<Integer> The number of bytes available to be allocated
</code></pre> </details>
<details> grow:
<pre><code> Dynamically grow the buffer such that the number of unallocated bytes is @requiredUnallocated bytes.
If the @requiredUnallocated bytes is smaller than the
the current consumable, then just answer the current
consumable.
Answers:
<Integer> The number of bytes available for allocation
</code></pre> </details>
<details> isBytes
<pre><code> Answers true if this buffer answers 'bytes', false if answers 'characters'
Answers:
<Boolean>
</code></pre> </details>
<details> isBytes:
<pre><code> If @aBoolean is true, data will be returned treated as bytes. If false then data will be returned as characters.
Arguments:
aBoolean - <Boolean>
</code></pre> </details>
<details> isFull
<pre><code> Answer true if the buffer is full This means the allocation end ptr can not be pushed forward any more
Answers:
<Boolean>
</code></pre> </details>
<details> next
<pre><code> Answer the next byte or char from the internal buffer
Answers:
<Integer | Character>
</code></pre> </details>
<details> next:
<pre><code> Answer a byte collection containing the next @anInteger elements.. Change the current ptr offset such that these elements are consumed.
Arguments:
anInteger - <Integer>
Answers:
<ByteArray | String>
</code></pre> </details>
<details> nextIfAtEnd:
<pre><code> Answer the next byte or char in this buffer stream. If this stream is at the end, answer the 0-arg @aBlock.
Answers:
<Integer | Character> next element
<Object> result of @aBlock
</code></pre> </details>
<details> nextPut:
<pre><code> Store @aByteOrChar at the current position. Increment the position offset by 1
Answers:
<Integer | Character>
</code></pre> </details>
<details> nextPutAll:size:
</details>
<details> peek
<pre><code> Answer the next byte or char from the internal buffer without moving the ptr cursor forward.
Answers:
<Integer | Character>
</code></pre> </details>
<details> position
<pre><code> Answer the current stream position in the buffer
Answers:
<Integer>
</code></pre> </details>
<details> reset
Reset pointers and the bytes consumed
</details>
<details> rewind
It is sufficient to the rewind the buffer by only making adjustments to
the offsets. The ptr and end OSObjects are allowed to fall behind
since they are updated in their accessor methods
</details>
<details> shrink
<pre><code> Dynamically shrink by half down, but no lower than the original size of the buffer.
Answers:
<Integer> The new size of the buffer
</code></pre> </details>
<details> shrink:
<pre><code> Dynamically shrink the buffer down to the @preferredSize. However, it must remain at least as large as the original size as well as large enough to hold the existing data.
Answers:
<Integer> The new size of the buffer
</code></pre> </details>
<details> size
<pre><code> Answer the size of the buffer
Answers:
<Integer>
</code></pre> </details>
<details> totalBytesConsumed
<pre><code> Answer the total number of bytes that has been consumed by this buffer
Answers:
<Integer>
</code></pre> </details>
<details> unallocated
<pre><code> Answer the number of unallocated bytes in the buffer
Answers:
<Integer>
</code></pre> </details>
<details> upToEnd
<pre><code> Answer this buffer as a collection class. The collection class is decided based on the species of this buffer.
Answers:
<ByteArray | String>
</code></pre> </details>