Package io.deephaven.io.streams
Class SimpleByteBufferSink
- java.lang.Object
-
- io.deephaven.io.streams.SimpleByteBufferSink
-
- All Implemented Interfaces:
ByteBufferSink,CurrentByteBufferSink
public class SimpleByteBufferSink extends java.lang.Object implements CurrentByteBufferSink
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.deephaven.io.streams.CurrentByteBufferSink
CurrentByteBufferSink.Adapter
-
-
Constructor Summary
Constructors Constructor Description SimpleByteBufferSink(java.nio.ByteBuffer b)SimpleByteBufferSink(java.nio.ByteBuffer b, boolean direct)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.ByteBufferacceptBuffer(java.nio.ByteBuffer b, int need)Dispose of the contents of the buffer b, probably by writing them to a channel, and return a new buffer in which writing can continue.voidclose(java.nio.ByteBuffer b)Dispose of the contents of the final buffer in an output sequence, probably by writing them to a channel.java.nio.ByteBuffergetBuffer()Access the current buffer for this sink.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.deephaven.io.streams.CurrentByteBufferSink
close, ensureSpace, flush
-
-
-
-
Method Detail
-
getBuffer
public java.nio.ByteBuffer getBuffer()
Description copied from interface:CurrentByteBufferSinkAccess the current buffer for this sink. This is either the initial buffer, or the last one provided byByteBufferSink.acceptBuffer(ByteBuffer, int)) orCurrentByteBufferSink.ensureSpace(int).- Specified by:
getBufferin interfaceCurrentByteBufferSink- Returns:
- The current buffer for this sink
-
acceptBuffer
public java.nio.ByteBuffer acceptBuffer(java.nio.ByteBuffer b, int need)Description copied from interface:ByteBufferSinkDispose of the contents of the buffer b, probably by writing them to a channel, and return a new buffer in which writing can continue. The returned buffer must have at least need bytes of space remaining. The return value may be the same buffer, as long as it's remaining() value has been increased to be >= need.- Specified by:
acceptBufferin interfaceByteBufferSink- Parameters:
b- the buffer whose contents need to be disposed of.- Returns:
- the buffer in which further output should be written.
-
close
public void close(java.nio.ByteBuffer b) throws java.io.IOExceptionDescription copied from interface:ByteBufferSinkDispose of the contents of the final buffer in an output sequence, probably by writing them to a channel. Note that the argument buffer may be empty. Then do whatever it takes to release the resources of the sink, probably by closing a channel.- Specified by:
closein interfaceByteBufferSink- Throws:
java.io.IOException
-
-