public class DataByteArrayOutputStream
extends java.io.OutputStream
implements java.io.DataOutput
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
buf |
protected AbstractVarIntSupport |
helper |
protected int |
pos |
| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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(java.lang.String s) |
void |
writeChar(int v) |
void |
writeChars(java.lang.String s) |
void |
writeDouble(double v) |
void |
writeFloat(float v) |
void |
writeInt(int v) |
void |
writeLong(long v) |
void |
writeShort(int v) |
void |
writeUTF(java.lang.String str) |
void |
writeVarInt(int value) |
void |
writeVarLong(long value) |
void |
writeVarSignedInt(int value) |
void |
writeVarSignedLong(long value) |
protected byte[] buf
protected int pos
protected AbstractVarIntSupport helper
public DataByteArrayOutputStream(int size)
size - the initial size.java.lang.IllegalArgumentException - if size is negative.public DataByteArrayOutputStream(byte[] buf)
public DataByteArrayOutputStream()
public void restart(int size)
size - public void restart()
public Buffer toBuffer()
public void write(int b)
throws java.io.IOException
write in interface java.io.DataOutputwrite in class java.io.OutputStreamb - the byte to be written.java.io.IOExceptionpublic void write(Buffer data) throws java.io.IOException
java.io.IOExceptionpublic void write(byte[] b,
int off,
int len)
throws java.io.IOException
len bytes from the specified byte array starting at
offset off to this byte array output stream.write in interface java.io.DataOutputwrite in class java.io.OutputStreamb - the data.off - the start offset in the data.len - the number of bytes to write.java.io.IOExceptionpublic byte[] getData()
public void reset()
public void position(int offset)
throws java.io.IOException
offset - java.io.IOExceptionpublic int position()
public int size()
public void writeBoolean(boolean v)
throws java.io.IOException
writeBoolean in interface java.io.DataOutputjava.io.IOExceptionpublic void writeByte(int v)
throws java.io.IOException
writeByte in interface java.io.DataOutputjava.io.IOExceptionpublic void writeShort(int v)
throws java.io.IOException
writeShort in interface java.io.DataOutputjava.io.IOExceptionpublic void writeChar(int v)
throws java.io.IOException
writeChar in interface java.io.DataOutputjava.io.IOExceptionpublic void writeInt(int v)
throws java.io.IOException
writeInt in interface java.io.DataOutputjava.io.IOExceptionpublic void writeLong(long v)
throws java.io.IOException
writeLong in interface java.io.DataOutputjava.io.IOExceptionpublic void writeFloat(float v)
throws java.io.IOException
writeFloat in interface java.io.DataOutputjava.io.IOExceptionpublic void writeDouble(double v)
throws java.io.IOException
writeDouble in interface java.io.DataOutputjava.io.IOExceptionpublic void writeBytes(java.lang.String s)
throws java.io.IOException
writeBytes in interface java.io.DataOutputjava.io.IOExceptionpublic void writeChars(java.lang.String s)
throws java.io.IOException
writeChars in interface java.io.DataOutputjava.io.IOExceptionpublic void writeUTF(java.lang.String str)
throws java.io.IOException
writeUTF in interface java.io.DataOutputjava.io.IOExceptionprotected void resize(int newcount)
protected void onWrite()
throws java.io.IOException
java.io.IOExceptionpublic void skip(int size)
throws java.io.IOException
java.io.IOExceptionpublic void writeVarInt(int value)
throws java.io.IOException
java.io.IOExceptionpublic void writeVarLong(long value)
throws java.io.IOException
java.io.IOExceptionpublic void writeVarSignedInt(int value)
throws java.io.IOException
java.io.IOExceptionpublic void writeVarSignedLong(long value)
throws java.io.IOException
java.io.IOExceptionCopyright © 2010-2014 FuseSource, Corp.. All Rights Reserved.