|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
org.fusesource.hawtbuf.DataByteArrayOutputStream
public class DataByteArrayOutputStream
Optimized ByteArrayOutputStream
Field Summary | |
---|---|
protected byte[] |
buf
|
protected AbstractVarIntSupport |
helper
|
protected int |
pos
|
Constructor Summary | |
---|---|
DataByteArrayOutputStream()
Creates a new byte array output stream. |
|
DataByteArrayOutputStream(byte[] buf)
|
|
DataByteArrayOutputStream(int size)
Creates a new byte array output stream, with a buffer capacity of the specified size, in bytes. |
Method Summary | |
---|---|
byte[] |
getData()
|
protected void |
onWrite()
This method is called after each write to the buffer. |
int |
position()
|
void |
position(int offset)
Set the current position for writing |
void |
reset()
reset the output stream |
protected void |
resize(int newcount)
|
void |
restart()
start using a fresh byte array |
void |
restart(int size)
start using a fresh byte array |
int |
size()
|
void |
skip(int size)
|
Buffer |
toBuffer()
Get a Buffer from the stream |
void |
write(Buffer data)
|
void |
write(byte[] b,
int off,
int len)
Writes len bytes from the specified byte array starting at
offset off to this byte array output stream. |
void |
write(int b)
Writes the specified byte to this byte array output stream. |
void |
writeBoolean(boolean v)
|
void |
writeByte(int v)
|
void |
writeBytes(String s)
|
void |
writeChar(int v)
|
void |
writeChars(String s)
|
void |
writeDouble(double v)
|
void |
writeFloat(float v)
|
void |
writeInt(int v)
|
void |
writeLong(long v)
|
void |
writeShort(int v)
|
void |
writeUTF(String str)
|
void |
writeVarInt(int value)
|
void |
writeVarLong(long value)
|
void |
writeVarSignedInt(int value)
|
void |
writeVarSignedLong(long value)
|
Methods inherited from class java.io.OutputStream |
---|
close, flush, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.io.DataOutput |
---|
write |
Field Detail |
---|
protected byte[] buf
protected int pos
protected AbstractVarIntSupport helper
Constructor Detail |
---|
public DataByteArrayOutputStream(int size)
size
- the initial size.
IllegalArgumentException
- if size is negative.public DataByteArrayOutputStream(byte[] buf)
public DataByteArrayOutputStream()
Method Detail |
---|
public void restart(int size)
size
- public void restart()
public Buffer toBuffer()
public void write(int b) throws IOException
write
in interface DataOutput
write
in class OutputStream
b
- the byte to be written.
IOException
public void write(Buffer data) throws IOException
IOException
public void write(byte[] b, int off, int len) throws IOException
len
bytes from the specified byte array starting at
offset off
to this byte array output stream.
write
in interface DataOutput
write
in class OutputStream
b
- the data.off
- the start offset in the data.len
- the number of bytes to write.
IOException
public byte[] getData()
public void reset()
public void position(int offset) throws IOException
offset
-
IOException
public int position()
public int size()
public void writeBoolean(boolean v) throws IOException
writeBoolean
in interface DataOutput
IOException
public void writeByte(int v) throws IOException
writeByte
in interface DataOutput
IOException
public void writeShort(int v) throws IOException
writeShort
in interface DataOutput
IOException
public void writeChar(int v) throws IOException
writeChar
in interface DataOutput
IOException
public void writeInt(int v) throws IOException
writeInt
in interface DataOutput
IOException
public void writeLong(long v) throws IOException
writeLong
in interface DataOutput
IOException
public void writeFloat(float v) throws IOException
writeFloat
in interface DataOutput
IOException
public void writeDouble(double v) throws IOException
writeDouble
in interface DataOutput
IOException
public void writeBytes(String s) throws IOException
writeBytes
in interface DataOutput
IOException
public void writeChars(String s) throws IOException
writeChars
in interface DataOutput
IOException
public void writeUTF(String str) throws IOException
writeUTF
in interface DataOutput
IOException
protected void resize(int newcount)
protected void onWrite() throws IOException
IOException
public void skip(int size) throws IOException
IOException
public void writeVarInt(int value) throws IOException
IOException
public void writeVarLong(long value) throws IOException
IOException
public void writeVarSignedInt(int value) throws IOException
IOException
public void writeVarSignedLong(long value) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |