Class FilterSeekableByteChannel<C extends java.nio.channels.SeekableByteChannel>

  • Type Parameters:
    C - the SeekableByteChannel 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.SeekableByteChannel, java.nio.channels.WritableByteChannel

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

    A FilterSeekableByteChannel 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 FilterSeekableByteChannel itself simply overrides methods of SeekableByteChannel with versions that pass all requests to the wrapped channel. Subclasses of FilterSeekableByteChannel may of course override any methods declared or inherited by FilterSeekableByteChannel, and may also provide additional fields and methods.

    You construct s simple instance with the Channel constructor and more advanced instances through the FilterSeekableByteChannel.Builder.

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

      • FilterSeekableByteChannel

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

      • position

        public long position()
                      throws java.io.IOException
        Specified by:
        position in interface java.nio.channels.SeekableByteChannel
        Throws:
        java.io.IOException
      • position

        public java.nio.channels.SeekableByteChannel position​(long newPosition)
                                                       throws java.io.IOException
        Specified by:
        position in interface java.nio.channels.SeekableByteChannel
        Throws:
        java.io.IOException
      • size

        public long size()
                  throws java.io.IOException
        Specified by:
        size in interface java.nio.channels.SeekableByteChannel
        Throws:
        java.io.IOException
      • truncate

        public java.nio.channels.SeekableByteChannel truncate​(long size)
                                                       throws java.io.IOException
        Specified by:
        truncate in interface java.nio.channels.SeekableByteChannel
        Throws:
        java.io.IOException