OsPipeStreamBuffer
Description
An internal class used as the buffer implementation for bytes to and from os processes
Class Methods
defaultSize
  Answer the default size of this buffer.

     Answers:
        <Integer>
maxSize
  Answer the maximum size of an buffer.
     This value is based on the offset constraints of OSObject's

     Answers:
        <Integer>
new
  Answer a new buffer that uses a default size

     Answers:
        <OsPipeStreamBuffer>
new:
  Answer a new byte buffer of size @aSize

     Arguments:
        aSize - Size of the buffer to allocate
     Answers:
        <OsPipeStreamBuffer>
new:isBytes:
  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>
Instance Methods
allocate:
  Allocate additional allocated bytes into the buffer

     Arguments:
        anInteger - <Integer> num bytes to move the allocation end offset forward
allocateAll
  Allocate the remaining unallocated space
allocated
  Answer the number of allocated bytes in the buffer

     Answers:
        <Integer>
atEnd
  Answer true if the current position ptr offset is the same as
     the end offset

     Answers:
        <Boolean>
atEndAndIsFull
  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>
consumable
  Answer the number of consumable bytes remaining in the buffer

     Answers:
        <Integer>
consume:
  Consume the buffer bytes by repositioning the current pointer

     Arguments:
        anInteger - <Integer> num bytes to move forward
consumeAll
  Consume all by setting the position offset to the end offset
consumed
  Answer the number of bytes consumed in the buffer

     Answers:
        <Integer>
exceptionClass:
No comment
flush:into:size:startingAt:
  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
grow
  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
grow:
  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
isBytes
  Answers true if this buffer answers 'bytes', false if answers 'characters'

     Answers:
        <Boolean>
isBytes:
  If @aBoolean is true, data will be returned treated as bytes. If false then
     data will be returned as characters.

    Arguments:
        aBoolean - <Boolean>
isFull
  Answer true if the buffer is full
     This means the allocation end ptr can not be
     pushed forward any more

     Answers:
        <Boolean>
next
  Answer the next byte or char from the internal buffer

     Answers:
        <Integer | Character>
next:
  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>
nextIfAtEnd:
  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
nextPut:
  Store @aByteOrChar at the current position.
     Increment the position offset by 1

     Answers:
        <Integer | Character>
nextPutAll:size:
No comment
peek
  Answer the next byte or char from the internal buffer
     without moving the ptr cursor forward.

     Answers:
        <Integer | Character>
position
  Answer the current stream position in the buffer

     Answers:
        <Integer>
reset
  Reset pointers and the bytes consumed
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
shrink
  Dynamically shrink by half down, but no lower than the
     original size of the buffer.

     Answers:
        <Integer> The new size of the buffer
shrink:
  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
size
  Answer the size of the buffer

     Answers:
        <Integer>
totalBytesConsumed
  Answer the total number of bytes that has been consumed by this buffer

     Answers:
        <Integer>
unallocated
  Answer the number of unallocated bytes in the buffer

     Answers:
        <Integer>
upToEnd
  Answer this buffer as a collection class.
     The collection class is decided based on the species of this buffer.

     Answers:
        <ByteArray | String>
Last modified date: 07/07/2022