Package org.apache.commons.io.channels
Class FilterSeekableByteChannel<C extends java.nio.channels.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- theSeekableByteChanneltype.
- 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
ASeekableByteChannelfilter which delegates to the wrappedSeekableByteChannel.A
FilterSeekableByteChannelwraps some other channel, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality. The classFilterSeekableByteChannelitself simply overrides methods ofSeekableByteChannelwith versions that pass all requests to the wrapped channel. Subclasses ofFilterSeekableByteChannelmay of course override any methods declared or inherited byFilterSeekableByteChannel, and may also provide additional fields and methods.You construct s simple instance with the
Channel constructorand more advanced instances through theFilterSeekableByteChannel.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 classFilterSeekableByteChannel.AbstractBuilder<F extends FilterSeekableByteChannel<C>,C extends java.nio.channels.SeekableByteChannel,B extends FilterSeekableByteChannel.AbstractBuilder<F,C,B>>Builds instances ofFilterSeekableByteChannelfor subclasses.static classFilterSeekableByteChannel.BuilderBuilds instances ofFilterSeekableByteChannel.
-
Constructor Summary
Constructors Constructor Description FilterSeekableByteChannel(C channel)Constructs a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FilterSeekableByteChannel.BuilderforSeekableByteChannel()Creates a newFilterSeekableByteChannel.Builder.longposition()java.nio.channels.SeekableByteChannelposition(long newPosition)longsize()java.nio.channels.SeekableByteChanneltruncate(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
-
-
-
-
Constructor Detail
-
FilterSeekableByteChannel
public FilterSeekableByteChannel(C channel)
Constructs a new instance.- Parameters:
channel- The channel to wrap.
-
-
Method Detail
-
forSeekableByteChannel
public static FilterSeekableByteChannel.Builder forSeekableByteChannel()
Creates a newFilterSeekableByteChannel.Builder.- Returns:
- a new
FilterSeekableByteChannel.Builder.
-
position
public long position() throws java.io.IOException
- Specified by:
positionin interfacejava.nio.channels.SeekableByteChannel- Throws:
java.io.IOException
-
position
public java.nio.channels.SeekableByteChannel position(long newPosition) throws java.io.IOException
- Specified by:
positionin interfacejava.nio.channels.SeekableByteChannel- Throws:
java.io.IOException
-
size
public long size() throws java.io.IOException
- Specified by:
sizein interfacejava.nio.channels.SeekableByteChannel- Throws:
java.io.IOException
-
truncate
public java.nio.channels.SeekableByteChannel truncate(long size) throws java.io.IOException
- Specified by:
truncatein interfacejava.nio.channels.SeekableByteChannel- Throws:
java.io.IOException
-
-