|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.OutputStream
com.github.libxjava.io.ByteArrayOutputBuffer
public final class ByteArrayOutputBuffer
This implementation is like the ByteArrayOutputStream
but not synchronised and it lets the user optimise byte array allocation.
Furthermore this type of OutputStream is not closable, so
it can be reused.
| Constructor Summary | |
|---|---|
ByteArrayOutputBuffer()
|
|
ByteArrayOutputBuffer(int size)
|
|
| Method Summary | |
|---|---|
void |
close()
This type of outputstream is not closable. |
byte[] |
getByteArrayReference()
Returns the reference to this buffer's byte array. |
void |
reset()
|
void |
resetNew()
Replaces the internal buffer with a new byte array of size 16. |
void |
resetNew(int size)
Replaces the internal buffer with a new byte array of size size. |
void |
setOutput(byte[] buffer,
int off)
Resets the internal buffer with the specified byte array and initialises the internal write pointer to off. |
int |
size()
|
byte[] |
toByteArray()
|
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
|
| 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 |
| Constructor Detail |
|---|
public ByteArrayOutputBuffer()
public ByteArrayOutputBuffer(int size)
| Method Detail |
|---|
public byte[] getByteArrayReference()
Remember that calling reset() only resets the
internal counter. If you do not want any changes in
the byte array obtained by this method, you need
to call resetNew() or resetNew(int)!
public byte[] toByteArray()
public void reset()
public void resetNew()
16.
Call of this method equals resetNew(16)
public void resetNew(int size)
size.
size -
public void setOutput(byte[] buffer,
int off)
off.
buffer - off - public int size()
public void close()
close in interface Closeableclose in class OutputStream
public void write(byte[] b,
int off,
int len)
write in class OutputStreampublic void write(int b)
write in class OutputStream
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||