Class CountingSeekableByteChannel
java.lang.Object
org.apache.beam.sdk.extensions.gcp.util.channels.CountingSeekableByteChannel
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ByteChannel
,Channel
,ReadableByteChannel
,SeekableByteChannel
,WritableByteChannel
-
Constructor Summary
ConstructorsConstructorDescriptionCountingSeekableByteChannel
(SeekableByteChannel delegate, @Nullable Consumer<Integer> bytesReadConsumer, @Nullable Consumer<Integer> bytesWrittenConsumer) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static CountingSeekableByteChannel
createWithBytesReadConsumer
(SeekableByteChannel delegate, Consumer<Integer> bytesReadConsumer) static CountingSeekableByteChannel
createWithBytesWrittenConsumer
(SeekableByteChannel delegate, Consumer<Integer> bytesWrittenConsumer) static CountingSeekableByteChannel
createWithNoOpConsumer
(SeekableByteChannel delegate) boolean
isOpen()
long
position()
position
(long newPosition) int
read
(ByteBuffer dst) long
size()
truncate
(long size) int
write
(ByteBuffer src)
-
Constructor Details
-
CountingSeekableByteChannel
-
-
Method Details
-
createWithBytesReadConsumer
public static CountingSeekableByteChannel createWithBytesReadConsumer(SeekableByteChannel delegate, Consumer<Integer> bytesReadConsumer) -
createWithBytesWrittenConsumer
public static CountingSeekableByteChannel createWithBytesWrittenConsumer(SeekableByteChannel delegate, Consumer<Integer> bytesWrittenConsumer) -
createWithNoOpConsumer
-
read
- Specified by:
read
in interfaceReadableByteChannel
- Specified by:
read
in interfaceSeekableByteChannel
- Throws:
IOException
-
write
- Specified by:
write
in interfaceSeekableByteChannel
- Specified by:
write
in interfaceWritableByteChannel
- Throws:
IOException
-
position
- Specified by:
position
in interfaceSeekableByteChannel
- Throws:
IOException
-
position
- Specified by:
position
in interfaceSeekableByteChannel
- Throws:
IOException
-
size
- Specified by:
size
in interfaceSeekableByteChannel
- Throws:
IOException
-
truncate
- Specified by:
truncate
in interfaceSeekableByteChannel
- Throws:
IOException
-
isOpen
public boolean isOpen() -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceChannel
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-