Package org.apache.commons.io.channels

# Class FilterSeekableByteChannel<C extends SeekableByteChannel>

java.lang.Object
org.apache.commons.io.channels.FilterChannel<C>
org.apache.commons.io.channels.FilterByteChannel<C>
org.apache.commons.io.channels.FilterSeekableByteChannel<C>

Type Parameters:
  `C` - the `SeekableByteChannel` type.

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `ByteChannel`, `Channel`, `ReadableByteChannel`, `SeekableByteChannel`, `WritableByteChannel`

public class FilterSeekableByteChannel<C extends SeekableByteChannel> extends FilterByteChannel<C> implements 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`

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `FilterSeekableByteChannel.AbstractBuilder<F extends FilterSeekableByteChannel<C>,C extends SeekableByteChannel,B extends FilterSeekableByteChannel.AbstractBuilder<F,C,B>>`
  Builds instances of `FilterSeekableByteChannel` for subclasses.
  `static class`
  `FilterSeekableByteChannel.Builder`
  Builds instances of `FilterSeekableByteChannel`.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FilterSeekableByteChannel(C channel)`
  Constructs a new instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static FilterSeekableByteChannel.Builder`
  `forSeekableByteChannel()`
  Creates a new `FilterSeekableByteChannel.Builder`.
  `long`
  `position()`
  `SeekableByteChannel`
  `position(long newPosition)`
  `long`
  `size()`
  `SeekableByteChannel`
  `truncate(long size)`

  ### Methods inherited from class org.apache.commons.io.channels.FilterByteChannel

  `forByteChannel, read, write`

  ### Methods inherited from class org.apache.commons.io.channels.FilterChannel

  `close, forChannel, isOpen, unwrap`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface java.nio.channels.Channel

  `close, isOpen`

  ### Methods inherited from interface java.nio.channels.SeekableByteChannel

  `read, write`

- ## Constructor Details

  - ### FilterSeekableByteChannel

    public FilterSeekableByteChannel(C channel)
    Constructs a new instance.
    Parameters:
      `channel` - The channel to wrap.

- ## Method Details

  - ### forSeekableByteChannel

    public static FilterSeekableByteChannel.Builder forSeekableByteChannel()
    Creates a new `FilterSeekableByteChannel.Builder`.
    Returns:
      a new `FilterSeekableByteChannel.Builder`.

  - ### position

    public long position() throws IOException
    Specified by:
      `position` in interface `SeekableByteChannel`
    Throws:
      `IOException`

  - ### position

    public SeekableByteChannel position(long newPosition) throws IOException
    Specified by:
      `position` in interface `SeekableByteChannel`
    Throws:
      `IOException`

  - ### size

    public long size() throws IOException
    Specified by:
      `size` in interface `SeekableByteChannel`
    Throws:
      `IOException`

  - ### truncate

    public SeekableByteChannel truncate(long size) throws IOException
    Specified by:
      `truncate` in interface `SeekableByteChannel`
    Throws:
      `IOException`