public class FastBufferOutputStream extends OutputStream
Constructor and Description |
---|
FastBufferOutputStream()
Creates instance of default initial capacity.
|
FastBufferOutputStream(ByteBuffer firstBuffer)
Creates instance for an already existing chain of byte arrays.
|
FastBufferOutputStream(int initialSize)
Creates instance with required initial capacity.
|
Modifier and Type | Method and Description |
---|---|
FastBufferWriter |
convertToWriter()
Returns instance of FastBufferWriter containing all data written to this output stream.
|
FastBufferWriter |
convertToWriter(String encoding)
Returns instance of FastBufferWriter containing all data written to this output stream.
|
ByteBuffer |
getFirstBuffer()
Returns the first link of the chain of byte arrays.
|
int |
getLength()
Returns the total number of written bytes.
|
void |
reset()
Resets stream to empty state
|
byte[] |
toByteArray() |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int c) |
void |
writeTo(OutputStream out)
Writes all data written up to the moment to out.
|
void |
writeTo(Writer out,
String encoding)
Writes all data written up to the moment to out.
|
close, flush
public FastBufferOutputStream()
public FastBufferOutputStream(ByteBuffer firstBuffer)
firstBuffer
- public FastBufferOutputStream(int initialSize)
initialSize
- public void write(int c) throws IOException
write
in class OutputStream
IOException
OutputStream.write(int)
public void write(byte[] b) throws IOException
write
in class OutputStream
IOException
OutputStream.write(byte [])
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
IOException
OutputStream.write(byte[], int, int)
public int getLength()
public ByteBuffer getFirstBuffer()
public byte[] toByteArray()
public void writeTo(OutputStream out) throws IOException
out
- IOException
public void writeTo(Writer out, String encoding) throws IOException
out
- IOException
public FastBufferWriter convertToWriter(String encoding) throws UnsupportedEncodingException
encoding
- UnsupportedEncodingException
public FastBufferWriter convertToWriter()
public void reset()
Copyright © 2015 JBoss by Red Hat. All Rights Reserved.