public class CountingSeekableByteChannel
extends java.lang.Object
implements java.nio.channels.SeekableByteChannel
| Constructor and Description |
|---|
CountingSeekableByteChannel(java.nio.channels.SeekableByteChannel delegate,
@Nullable java.util.function.Consumer<java.lang.Integer> bytesReadConsumer,
@Nullable java.util.function.Consumer<java.lang.Integer> bytesWrittenConsumer) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
static CountingSeekableByteChannel |
createWithBytesReadConsumer(java.nio.channels.SeekableByteChannel delegate,
java.util.function.Consumer<java.lang.Integer> bytesReadConsumer) |
static CountingSeekableByteChannel |
createWithBytesWrittenConsumer(java.nio.channels.SeekableByteChannel delegate,
java.util.function.Consumer<java.lang.Integer> bytesWrittenConsumer) |
static CountingSeekableByteChannel |
createWithNoOpConsumer(java.nio.channels.SeekableByteChannel delegate) |
boolean |
isOpen() |
long |
position() |
java.nio.channels.SeekableByteChannel |
position(long newPosition) |
int |
read(java.nio.ByteBuffer dst) |
long |
size() |
java.nio.channels.SeekableByteChannel |
truncate(long size) |
int |
write(java.nio.ByteBuffer src) |
public CountingSeekableByteChannel(java.nio.channels.SeekableByteChannel delegate,
@Nullable java.util.function.Consumer<java.lang.Integer> bytesReadConsumer,
@Nullable java.util.function.Consumer<java.lang.Integer> bytesWrittenConsumer)
public static CountingSeekableByteChannel createWithBytesReadConsumer(java.nio.channels.SeekableByteChannel delegate, java.util.function.Consumer<java.lang.Integer> bytesReadConsumer)
public static CountingSeekableByteChannel createWithBytesWrittenConsumer(java.nio.channels.SeekableByteChannel delegate, java.util.function.Consumer<java.lang.Integer> bytesWrittenConsumer)
public static CountingSeekableByteChannel createWithNoOpConsumer(java.nio.channels.SeekableByteChannel delegate)
public int read(java.nio.ByteBuffer dst)
throws java.io.IOException
read in interface java.nio.channels.ReadableByteChannelread in interface java.nio.channels.SeekableByteChanneljava.io.IOExceptionpublic int write(java.nio.ByteBuffer src)
throws java.io.IOException
write in interface java.nio.channels.SeekableByteChannelwrite in interface java.nio.channels.WritableByteChanneljava.io.IOExceptionpublic long position()
throws java.io.IOException
position in interface java.nio.channels.SeekableByteChanneljava.io.IOExceptionpublic java.nio.channels.SeekableByteChannel position(long newPosition)
throws java.io.IOException
position in interface java.nio.channels.SeekableByteChanneljava.io.IOExceptionpublic long size()
throws java.io.IOException
size in interface java.nio.channels.SeekableByteChanneljava.io.IOExceptionpublic java.nio.channels.SeekableByteChannel truncate(long size)
throws java.io.IOException
truncate in interface java.nio.channels.SeekableByteChanneljava.io.IOExceptionpublic boolean isOpen()
isOpen in interface java.nio.channels.Channelpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface java.nio.channels.Channeljava.io.IOException