public class StreamOutput extends BufferedOutput
BufferedOutput that writes all data to destination OutputStream.| Modifier and Type | Field and Description |
|---|---|
protected OutputStream |
out |
buffer, EMPTY_BYTE_ARRAY, limit, position, totalPositionBase| Constructor and Description |
|---|
StreamOutput()
Creates a new stream output with default buffer capacity.
|
StreamOutput(int size)
Creates a new stream output with specified buffer capacity.
|
StreamOutput(OutputStream out)
Creates a new stream output with specified destination output stream and default buffer capacity.
|
StreamOutput(OutputStream out,
int size)
Creates a new stream output with specified destination output stream and buffer capacity.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
protected void |
needSpace()
This method is invoked when output methods need more space to write data.
|
void |
resetOutput()
Resets this stream output by releasing underlying output stream
and clears any data that was not flushed to the previous output.
|
void |
setOutput(OutputStream out)
Sets new destination output stream.
|
void |
write(byte[] b,
int off,
int len) |
checkEOB, totalPosition, write, write, writeAllFromChunkList, writeBoolean, writeByte, writeByteArray, writeBytes, writeChar, writeChars, writeCompactInt, writeCompactLong, writeDouble, writeFloat, writeFromByteBuffer, writeFromChunk, writeFromDataInput, writeFromInputStream, writeInt, writeLong, writeMarshalled, writeObject, writeProperties, writeShort, writeUTF, writeUTFChar, writeUTFStringprotected OutputStream out
public StreamOutput()
public StreamOutput(int size)
size - the initial buffer sizeIllegalArgumentException - if size is not positivepublic StreamOutput(OutputStream out)
out - the destination to write topublic StreamOutput(OutputStream out, int size)
out - the destination to write tosize - the initial buffer sizeIllegalArgumentException - if size is not positivepublic void setOutput(OutputStream out)
null to release destination.
Clears any data that was not flushed to the previous output.
The totalPosition is reset to 0.out - the destination to write topublic void resetOutput()
public void flush()
throws IOException
flush in interface Flushableflush in interface ObjectOutputflush in class OutputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface ObjectOutputclose in interface AutoCloseableclose in class OutputStreamIOExceptionpublic void write(byte[] b,
int off,
int len)
throws IOException
write in interface DataOutputwrite in interface ObjectOutputwrite in class BufferedOutputIOExceptionprotected void needSpace()
throws IOException
BufferedOutput(position < limit)
is true or throw an exception. This method may block if needed.
This method is allowed to update BufferedOutput.buffer, BufferedOutput.position and
BufferedOutput.limit fields as needed and should maintain BufferedOutput.totalPositionBase accordingly.needSpace in class BufferedOutputIOException - if an I/O error occursCopyright © 2002–2025 Devexperts LLC. All rights reserved.