com.voytechs.jnetstream.io
Class ExpandableByteArrayInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.ByteArrayInputStream
          extended by com.voytechs.jnetstream.io.ExpandableByteArrayInputStream
All Implemented Interfaces:
java.io.Closeable

public class ExpandableByteArrayInputStream
extends java.io.ByteArrayInputStream

Allows a regular ByteArrayInputStream to be expanded and size and capacity after its creation.

Since:
0.3.0
Author:
Mark Bednarczyk

Field Summary
static java.lang.String MODULE
           
 
Fields inherited from class java.io.ByteArrayInputStream
buf, count, mark, pos
 
Constructor Summary
ExpandableByteArrayInputStream()
           
ExpandableByteArrayInputStream(byte[] buf)
           
ExpandableByteArrayInputStream(byte[] buf, int offset, int length)
           
 
Method Summary
 void setBuffer(byte[] buf)
          Set a new buffer so that it uses buf as its buffer array.
 void setBuffer(byte[] buf, int offset, int length)
          Set a new buffer so that it uses buf as its buffer array.
 
Methods inherited from class java.io.ByteArrayInputStream
available, close, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.io.InputStream
read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODULE

public static final java.lang.String MODULE
See Also:
Constant Field Values
Constructor Detail

ExpandableByteArrayInputStream

public ExpandableByteArrayInputStream()

ExpandableByteArrayInputStream

public ExpandableByteArrayInputStream(byte[] buf)
Parameters:
-
Throws:

ExpandableByteArrayInputStream

public ExpandableByteArrayInputStream(byte[] buf,
                                      int offset,
                                      int length)
Parameters:
-
Throws:
Method Detail

setBuffer

public void setBuffer(byte[] buf)
Set a new buffer so that it uses buf as its buffer array. The buffer array is not copied. The initial value of pos is 0 and the initial value of count is the length of buf.


setBuffer

public void setBuffer(byte[] buf,
                      int offset,
                      int length)
Set a new buffer so that it uses buf as its buffer array. The buffer array is not copied. The initial value of pos is 0 and the initial value of count is the length of buf.