Class BufferedChannel
java.lang.Object
org.gridgain.internal.snapshots.buffer.BufferedChannel
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,WritableByteChannel
Implementation of
WritableByteChannel with intermediate byte buffer cache.-
Constructor Summary
ConstructorsConstructorDescriptionBufferedChannel(WritableByteChannel channel, DisposableByteBuffer buffer) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()booleanisOpen()intwrite(ByteBuffer data) Writes the provided bytes of data to the buffer with the eviction logic (writing) into the channel in case of buffer overflow.
-
Constructor Details
-
BufferedChannel
Constructor.- Parameters:
channel- Writable byte channel.buffer- Disposable buffer.
-
-
Method Details
-
write
Writes the provided bytes of data to the buffer with the eviction logic (writing) into the channel in case of buffer overflow.- Specified by:
writein interfaceWritableByteChannel- Parameters:
data- Byte buffer to write.- Returns:
- The number of bytes written, possibly zero in case when buffer has space to persist data buffer.
- Throws:
IOException- In case when channel throws exception on write.
-
isOpen
public boolean isOpen() -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Throws:
IOException
-