public class DataByteArrayOutputStream extends OutputStream implements DataOutput
| Constructor and Description |
|---|
DataByteArrayOutputStream()
Creates a new byte array output stream.
|
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 |
|---|---|
ByteSequence |
getByteSequence() |
byte[] |
getData() |
protected void |
onWrite()
This method is called after each write to the buffer.
|
void |
position(int offset)
Set the current position for writing
|
void |
reset()
reset the output stream
|
void |
restart()
start using a fresh byte array
|
void |
restart(int size)
start using a fresh byte array
|
int |
size() |
void |
skip(int size) |
ByteSequence |
toByteSequence()
Get a ByteSequence from the stream
|
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 text) |
close, flush, writeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwritepublic DataByteArrayOutputStream(int size)
size - the initial size.IllegalArgumentException - if size is negative.public DataByteArrayOutputStream()
public void restart(int size)
size - public void restart()
public ByteSequence toByteSequence()
public void write(int b) throws IOException
write in interface DataOutputwrite in class OutputStreamb - the byte to be written.IOExceptionpublic 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 DataOutputwrite in class OutputStreamb - the data.off - the start offset in the data.len - the number of bytes to write.IOExceptionpublic byte[] getData()
public void reset()
public void position(int offset) throws IOException
offset - IOExceptionpublic int size()
public void writeBoolean(boolean v) throws IOException
writeBoolean in interface DataOutputIOExceptionpublic void writeByte(int v) throws IOException
writeByte in interface DataOutputIOExceptionpublic void writeShort(int v) throws IOException
writeShort in interface DataOutputIOExceptionpublic void writeChar(int v) throws IOException
writeChar in interface DataOutputIOExceptionpublic void writeInt(int v) throws IOException
writeInt in interface DataOutputIOExceptionpublic void writeLong(long v) throws IOException
writeLong in interface DataOutputIOExceptionpublic void writeFloat(float v) throws IOException
writeFloat in interface DataOutputIOExceptionpublic void writeDouble(double v) throws IOException
writeDouble in interface DataOutputIOExceptionpublic void writeBytes(String s) throws IOException
writeBytes in interface DataOutputIOExceptionpublic void writeChars(String s) throws IOException
writeChars in interface DataOutputIOExceptionpublic void writeUTF(String text) throws IOException
writeUTF in interface DataOutputIOExceptionprotected void onWrite() throws IOException
IOExceptionpublic void skip(int size) throws IOException
IOExceptionpublic ByteSequence getByteSequence()
Copyright © 2005–2017 FuseSource, Corp.. All rights reserved.