|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.OutputStream
java.io.FilterOutputStream
java.io.DataOutputStream
com.nhncorp.neptune.common.io.NDataOutputBuffer
public class NDataOutputBuffer
A reusable DataOutput implementation that writes to an in-memory
buffer.
This saves memory over creating a new DataOutputStream and ByteArrayOutputStream each time data is written.
Typical usage is something like the following:
DataOutputBuffer buffer = new DataOutputBuffer();
while (... loop condition ...) {
buffer.reset();
... write buffer using DataOutput methods ...
byte[] data = buffer.getData();
int dataLength = buffer.getLength();
... write data to its ultimate destination ...
}
| Constructor Summary | |
|---|---|
NDataOutputBuffer()
Constructs a new empty buffer. |
|
| Method Summary | |
|---|---|
byte[] |
getData()
Returns the current contents of the buffer. |
int |
getLength()
Returns the length of the valid data currently in the buffer. |
NDataOutputBuffer |
reset()
Resets the buffer to empty. |
void |
write(java.io.DataInput in,
int length)
Writes bytes from a DataInput directly into the buffer. |
| Methods inherited from class java.io.DataOutputStream |
|---|
flush, size, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF |
| Methods inherited from class java.io.FilterOutputStream |
|---|
close, write |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.io.DataOutput |
|---|
write |
| Constructor Detail |
|---|
public NDataOutputBuffer()
| Method Detail |
|---|
public byte[] getData()
getLength().
public int getLength()
public NDataOutputBuffer reset()
public void write(java.io.DataInput in,
int length)
throws java.io.IOException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||