Package com.helger.io.channel
Class ChannelHelper
java.lang.Object
com.helger.io.channel.ChannelHelper
Some very basic NIO channel utility stuff.
- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionstatic longchannelCopy(@NonNull ReadableByteChannel aSrc, @NonNull WritableByteChannel aDest) Copy all content from the source channel to the destination channel.static @NonNull com.helger.base.state.ESuccessClose the passed channel if it is notnulland still open.static @NonNull com.helger.base.state.ESuccessRelease the passed file lock if it is notnull.
-
Method Details
-
channelCopy
@Nonnegative public static long channelCopy(@WillNotClose @NonNull ReadableByteChannel aSrc, @WillNotClose @NonNull WritableByteChannel aDest) throws IOException Copy all content from the source channel to the destination channel.- Parameters:
aSrc- Source channel. May not benull. Is not closed after the operation.aDest- Destination channel. May not benull. Is not closed after the operation.- Returns:
- The number of bytes written.
- Throws:
IOException- In case of IO error
-
close
Close the passed channel if it is notnulland still open.- Parameters:
aChannel- The channel to be closed. May benull.- Returns:
ESuccess.SUCCESSif the channel was successfully closed,ESuccess.FAILUREotherwise.
-
release
Release the passed file lock if it is notnull.- Parameters:
aFileLock- The file lock to be released. May benull.- Returns:
ESuccess.SUCCESSif the lock was successfully released,ESuccess.FAILUREotherwise.
-