|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
org.apache.derby.client.net.DynamicByteArrayOutputStream
public class DynamicByteArrayOutputStream
A DynamicByteArrayOutputStream allows writing to a dynamically resizable array of bytes. In addition to dynamic resizing, this extension allows the user of this class to have more control over the position of the stream and can get a direct reference of the array. This code is cloned from org.apache.derby.iapi.services.io.DynamicByteArrayOutputStream for use by the client.
Field Summary | |
---|---|
private int |
beginPosition
|
private byte[] |
buf
|
private static int |
INITIAL_SIZE
|
private int |
position
|
private int |
used
|
Constructor Summary | |
---|---|
DynamicByteArrayOutputStream()
|
|
DynamicByteArrayOutputStream(byte[] data)
|
|
DynamicByteArrayOutputStream(DynamicByteArrayOutputStream toBeCloned)
|
|
DynamicByteArrayOutputStream(int size)
|
Method Summary | |
---|---|
void |
close()
|
void |
discardLeft(int amountToShrinkBy)
Shrink the buffer left by the amount given. |
private void |
expandBuffer(int minExtension)
Expand the buffer by at least the number of bytes requested in minExtension. |
int |
getBeginPosition()
Get the current position in the stream |
byte[] |
getByteArray()
Get a reference to the byte array stored in the byte array output stream. |
int |
getPosition()
Get the current position in the stream |
int |
getUsed()
Get the number of bytes that was used. |
void |
reset()
Reset the stream for reuse |
void |
setBeginPosition(int newBeginPosition)
Set the begin position of the stream pointer. |
void |
setPosition(int newPosition)
Set the position of the stream pointer. |
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
(package private) void |
writeCompleteStream(java.io.InputStream dataIn,
int len)
|
Methods inherited from class java.io.OutputStream |
---|
flush, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static int INITIAL_SIZE
private byte[] buf
private int position
private int used
private int beginPosition
Constructor Detail |
---|
public DynamicByteArrayOutputStream()
public DynamicByteArrayOutputStream(int size)
public DynamicByteArrayOutputStream(byte[] data)
public DynamicByteArrayOutputStream(DynamicByteArrayOutputStream toBeCloned)
Method Detail |
---|
public void write(int b)
write
in class java.io.OutputStream
public void write(byte[] b, int off, int len)
write
in class java.io.OutputStream
void writeCompleteStream(java.io.InputStream dataIn, int len) throws java.io.IOException
java.io.IOException
public void close()
close
in interface java.io.Closeable
close
in class java.io.OutputStream
public void reset()
public byte[] getByteArray()
public int getUsed()
public int getPosition()
public int getBeginPosition()
public void setPosition(int newPosition)
public void setBeginPosition(int newBeginPosition)
public void discardLeft(int amountToShrinkBy)
private void expandBuffer(int minExtension)
|
Built on Thu 2012-03-29 21:53:33+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |