Class FilterByteChannel<C extends java.nio.channels.ByteChannel>

  • Type Parameters:
    C - the ByteChannel type.
    All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, java.nio.channels.ByteChannel, java.nio.channels.Channel, java.nio.channels.ReadableByteChannel, java.nio.channels.WritableByteChannel
    Direct Known Subclasses:
    FilterSeekableByteChannel

    public class FilterByteChannel<C extends java.nio.channels.ByteChannel>
    extends FilterChannel<C>
    implements java.nio.channels.ByteChannel
    A ByteChannel filter which delegates to the wrapped ByteChannel.

    A FilterByteChannel wraps some other channel, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality. The class FilterByteChannel itself simply overrides methods of ByteChannel with versions that pass all requests to the wrapped channel. Subclasses of FilterByteChannel may of course override any methods declared or inherited by FilterByteChannel, and may also provide additional fields and methods.

    You construct s simple instance with the channel constructor and more advanced instances through the FilterByteChannel.Builder.

    Since:
    2.22.0
    See Also:
    FilterInputStream, FilterOutputStream, FilterReader, FilterWritableByteChannel, ProxyInputStream, ProxyOutputStream, ProxyReader, ProxyWriter
    • Constructor Detail

      • FilterByteChannel

        public FilterByteChannel​(C byteChannel)
        Constructs a new instance.
        Parameters:
        byteChannel - The channel to wrap.
    • Method Detail

      • read

        public int read​(java.nio.ByteBuffer dst)
                 throws java.io.IOException
        Specified by:
        read in interface java.nio.channels.ReadableByteChannel
        Throws:
        java.io.IOException
      • write

        public int write​(java.nio.ByteBuffer src)
                  throws java.io.IOException
        Specified by:
        write in interface java.nio.channels.WritableByteChannel
        Throws:
        java.io.IOException