Package org.apache.commons.io.channels
Class FilterChannel<C extends java.nio.channels.Channel>
- java.lang.Object
-
- org.apache.commons.io.channels.FilterChannel<C>
-
- Type Parameters:
C- theChanneltype.
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.nio.channels.Channel
- Direct Known Subclasses:
FilterByteChannel,FilterReadableByteChannel,FilterWritableByteChannel
public class FilterChannel<C extends java.nio.channels.Channel> extends java.lang.Object implements java.nio.channels.Channel
AChannelfilter which delegates to the wrappedChannel.A
FilterChannelwraps some other channel, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality. The classFilterChannelitself simply overrides methods ofChannelwith versions that pass all requests to the wrapped channel. Subclasses ofFilterChannelmay of course override any methods declared or inherited byFilterChannel, and may also provide additional fields and methods.You construct s simple instance with the
channel constructorand more advanced instances through theFilterChannel.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 classFilterChannel.AbstractBuilder<F extends FilterChannel<C>,C extends java.nio.channels.Channel,B extends FilterChannel.AbstractBuilder<F,C,B>>Builds instances ofFilterChannelfor subclasses.static classFilterChannel.BuilderBuilds instances ofFilterChannel.
-
Constructor Summary
Constructors Constructor Description FilterChannel(C channel)Constructs a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static FilterChannel.BuilderforChannel()Creates a newFilterChannel.Builder.booleanisOpen()Cunwrap()Unwraps this instance by returning the underlyingChannelof typeC.
-
-
-
Constructor Detail
-
FilterChannel
public FilterChannel(C channel)
Constructs a new instance.- Parameters:
channel- The channel to wrap.
-
-
Method Detail
-
forChannel
public static FilterChannel.Builder forChannel()
Creates a newFilterChannel.Builder.- Returns:
- a new
FilterChannel.Builder.
-
close
public void close() throws java.io.IOException
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.nio.channels.Channel- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
isOpen
public boolean isOpen()
- Specified by:
isOpenin interfacejava.nio.channels.Channel
-
-