Package org.apache.commons.io.channels
Class FilterByteChannel<C extends java.nio.channels.ByteChannel>
- java.lang.Object
-
- org.apache.commons.io.channels.FilterChannel<C>
-
- org.apache.commons.io.channels.FilterByteChannel<C>
-
- Type Parameters:
C- theByteChanneltype.
- 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
AByteChannelfilter which delegates to the wrappedByteChannel.A
FilterByteChannelwraps some other channel, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality. The classFilterByteChannelitself simply overrides methods ofByteChannelwith versions that pass all requests to the wrapped channel. Subclasses ofFilterByteChannelmay of course override any methods declared or inherited byFilterByteChannel, and may also provide additional fields and methods.You construct s simple instance with the
channel constructorand more advanced instances through theFilterByteChannel.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 classFilterByteChannel.AbstractBuilder<F extends FilterByteChannel<C>,C extends java.nio.channels.ByteChannel,B extends FilterByteChannel.AbstractBuilder<F,C,B>>Builds instances ofFilterByteChannelfor subclasses.static classFilterByteChannel.BuilderBuilds instances ofFilterByteChannel.
-
Constructor Summary
Constructors Constructor Description FilterByteChannel(C byteChannel)Constructs a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FilterByteChannel.BuilderforByteChannel()Creates a newFilterByteChannel.Builder.intread(java.nio.ByteBuffer dst)intwrite(java.nio.ByteBuffer src)-
Methods inherited from class org.apache.commons.io.channels.FilterChannel
close, forChannel, isOpen, unwrap
-
-
-
-
Constructor Detail
-
FilterByteChannel
public FilterByteChannel(C byteChannel)
Constructs a new instance.- Parameters:
byteChannel- The channel to wrap.
-
-
Method Detail
-
forByteChannel
public static FilterByteChannel.Builder forByteChannel()
Creates a newFilterByteChannel.Builder.- Returns:
- a new
FilterByteChannel.Builder.
-
read
public int read(java.nio.ByteBuffer dst) throws java.io.IOException
- Specified by:
readin interfacejava.nio.channels.ReadableByteChannel- Throws:
java.io.IOException
-
write
public int write(java.nio.ByteBuffer src) throws java.io.IOException
- Specified by:
writein interfacejava.nio.channels.WritableByteChannel- Throws:
java.io.IOException
-
-