Package org.apache.commons.io.channels
Class FilterChannel<C extends Channel>
java.lang.Object
org.apache.commons.io.channels.FilterChannel<C>
- Type Parameters:
C- theChanneltype.
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel
- Direct Known Subclasses:
FilterByteChannel,FilterReadableByteChannel,FilterWritableByteChannel
A
Channel filter which delegates to the wrapped Channel.
A FilterChannel 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 FilterChannel itself simply overrides methods of Channel with versions that pass all requests to the
wrapped channel. Subclasses of FilterChannel may of course override any methods declared or inherited by FilterChannel, and may also provide
additional fields and methods.
You construct s simple instance with the channel constructor and more advanced instances through the
FilterChannel.Builder.
- Since:
- 2.22.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFilterChannel.AbstractBuilder<F extends FilterChannel<C>,C extends Channel, B extends FilterChannel.AbstractBuilder<F, C, B>> Builds instances ofFilterChannelfor subclasses.static classBuilds instances ofFilterChannel. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static FilterChannel.BuilderCreates a newFilterChannel.Builder.booleanisOpen()unwrap()Unwraps this instance by returning the underlyingChannelof typeC.
-
Constructor Details
-
FilterChannel
Constructs a new instance.- Parameters:
channel- The channel to wrap.
-
-
Method Details
-
forChannel
Creates a newFilterChannel.Builder.- Returns:
- a new
FilterChannel.Builder.
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Throws:
IOException
-
isOpen
-
unwrap
- Returns:
- the underlying channel of type
C.
-