Package org.apache.commons.io.channels
Class CloseShieldChannel
- java.lang.Object
-
- org.apache.commons.io.channels.CloseShieldChannel
-
public final class CloseShieldChannel extends java.lang.Object
Creates a close-shielding proxy for aChannel.The returned proxy implements all
Channelsub-interfaces that are both supported by this implementation and actually implemented by the given delegate.The following interfaces are supported:
AsynchronousChannelByteChannelChannelGatheringByteChannelInterruptibleChannelNetworkChannelReadableByteChannelScatteringByteChannelSeekableByteChannelWritableByteChannel
- Since:
- 2.21.0
- See Also:
Channel,Closeable
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends java.nio.channels.Channel>
Twrap(T channel)Wraps a channel to shield it from being closed.
-
-
-
Method Detail
-
wrap
public static <T extends java.nio.channels.Channel> T wrap(T channel)
Wraps a channel to shield it from being closed.- Type Parameters:
T- A supported channel type.- Parameters:
channel- The underlying channel to shield, notnull.- Returns:
- A proxy that shields
close()and enforces closed semantics on other calls. - Throws:
java.lang.ClassCastException- ifTis not a supported channel type.java.lang.NullPointerException- ifchannelisnull.
-
-