|
|
|
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.OutputStream
org.torweg.pulse.util.io.FastByteArrayOutputStream
public final class FastByteArrayOutputStream
A not thread-safe replacement for
ByteArrayOutputStream.
FastStringWriter| Constructor Summary | |
|---|---|
FastByteArrayOutputStream()
creates a new byte array output stream. |
|
FastByteArrayOutputStream(int size)
creates a new byte array output stream, with a buffer capacity of the specified size, in bytes. |
|
FastByteArrayOutputStream(int size,
java.io.OutputStream target)
creates a new byte array output stream, with a buffer capacity of the specified size, in bytes writing through to the given OutputStream. |
|
FastByteArrayOutputStream(java.io.OutputStream target)
creates a new byte array output stream writing through to the given OutputStream. |
|
| Method Summary | |
|---|---|
void |
close()
closes the optional write-through OutputStream. |
void |
flush()
flushes the optional write-through OutputStream. |
byte[] |
getByteArray()
returns a reference of the underlying byte array buffer, thus avoiding a duplication of the buffer in memory. |
int |
size()
returns the current size of the bytes buffered. |
java.lang.String |
toString()
converts the buffer's contents into a string, translating bytes into characters according to the platform's default character encoding. |
java.lang.String |
toString(java.lang.String enc)
converts the buffer's contents into a string, translating bytes into characters according to the specified character encoding. |
void |
write(byte[] b,
int off,
int len)
|
void |
write(int b)
writes the specified byte to the byte buffer. |
void |
writeTo(java.io.OutputStream out)
writes the currently buffered bytes to the given OutputStream. |
| Methods inherited from class java.io.OutputStream |
|---|
write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public FastByteArrayOutputStream()
public FastByteArrayOutputStream(java.io.OutputStream target)
OutputStream. The buffer capacity is initially 1024 bytes, though
its size increases if necessary.
target - the output stream to write throughpublic FastByteArrayOutputStream(int size)
size - the initial size
java.lang.IllegalArgumentException - if size is negative
public FastByteArrayOutputStream(int size,
java.io.OutputStream target)
OutputStream.
size - the initial sizetarget - the output stream to write through
java.lang.IllegalArgumentException - if size is negative| Method Detail |
|---|
public void write(int b)
write in class java.io.OutputStreamb - the byte to be written
WriteThroughException - on I/O errors in the optional write-through
OutputStream
public void write(byte[] b,
int off,
int len)
write in class java.io.OutputStreamWriteThroughException - on I/O errors in the optional write-through
OutputStream
public void writeTo(java.io.OutputStream out)
throws java.io.IOException
OutputStream.
out - the output stream to which to write the data
java.io.IOException - if an I/O error occurs.public byte[] getByteArray()
public int size()
public java.lang.String toString()
toString in class java.lang.Object
public java.lang.String toString(java.lang.String enc)
throws java.io.UnsupportedEncodingException
enc - a character-encoding name.
java.io.UnsupportedEncodingException - If the named encoding is not supported.public void flush()
OutputStream.
flush in interface java.io.Flushableflush in class java.io.OutputStreamWriteThroughException - on I/O errors in the optional write-through
OutputStreamFastByteArrayOutputStream(OutputStream), FastByteArrayOutputStream(int,OutputStream)public void close()
OutputStream.
close in interface java.io.Closeableclose in class java.io.OutputStreamWriteThroughException - on I/O errors in the optional write-through
OutputStreamFastByteArrayOutputStream(OutputStream), FastByteArrayOutputStream(int,OutputStream)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||