public static class ByteBufferStreams.Output extends OutputStream implements DataOutput
| Constructor and Description |
|---|
Output(ByteBuffer dest) |
Output(ByteBuffer dest,
BiFunction<ByteBufferStreams.Output,Integer,ByteBuffer> onFull)
Create a ByteBuffer output stream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
ByteBuffer |
getBuffer()
Get the current working buffer for this stream.
|
void |
setBuffer(ByteBuffer dest)
Set the buffer for this stream.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(ByteBuffer in)
Primitive to write a ByteBuffer directly into the stream.
|
void |
write(int b) |
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 s) |
public Output(ByteBuffer dest)
public Output(ByteBuffer dest, BiFunction<ByteBufferStreams.Output,Integer,ByteBuffer> onFull)
dest - initial buffer (null allowed)onFull - callback to invoke on full. The callback will be called
with the ByteBufferStreams.Output object and the number of bytes of room needed,
and must return a buffer capable of ingesting that many bytes. The prior buffer
will simply be tossed away, so if you are going to grow the buffer in place,
you need to copy data, or you can take the buffer and send it on it's way.public void flush()
flush in interface Flushableflush in class OutputStreampublic void close()
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreampublic ByteBuffer getBuffer()
public void setBuffer(ByteBuffer dest)
dest - new bufferpublic void write(int b)
throws IOException
write in interface DataOutputwrite in class OutputStreamIOExceptionpublic void write(byte[] b)
throws IOException
write in interface DataOutputwrite in class OutputStreamIOExceptionpublic void write(byte[] b,
int off,
int len)
throws IOException
write in interface DataOutputwrite in class OutputStreamIOExceptionpublic 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 s) throws IOException
writeUTF in interface DataOutputIOExceptionpublic void write(ByteBuffer in) throws IOException
in - buffer to write.IOException - on errorCopyright © 2020. All rights reserved.