Package org.aksw.commons.io.util
Class FileChannelUtils
java.lang.Object
org.aksw.commons.io.util.FileChannelUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longtransferFromFully(FileChannel destChannel, FileChannel srcChannel, long destOffset, long length, Consumer<Long> contribCallback) Repeatedly invokeFileChannel.transferFrom(java.nio.channels.ReadableByteChannel, long, long)until length bytes were transferred.static longtransferFromFully(FileChannel destChannel, Path srcPath, long targetOffset, long length, Consumer<Long> contribCallback) Invoke transferFrom on dest it with the given arguments; opens a file channel on srcstatic longtransferFromFully(FileChannel dest, PathTransfer pathTransfer, Consumer<Long> contribCallback) Invoke transferFrom on dest with arguments based on pathTransfer
-
Constructor Details
-
FileChannelUtils
public FileChannelUtils()
-
-
Method Details
-
transferFromFully
public static long transferFromFully(FileChannel dest, PathTransfer pathTransfer, Consumer<Long> contribCallback) throws IOException Invoke transferFrom on dest with arguments based on pathTransfer- Throws:
IOException
-
transferFromFully
public static long transferFromFully(FileChannel destChannel, Path srcPath, long targetOffset, long length, Consumer<Long> contribCallback) throws IOException Invoke transferFrom on dest it with the given arguments; opens a file channel on src- Throws:
IOException
-
transferFromFully
public static long transferFromFully(FileChannel destChannel, FileChannel srcChannel, long destOffset, long length, Consumer<Long> contribCallback) throws IOException Repeatedly invokeFileChannel.transferFrom(java.nio.channels.ReadableByteChannel, long, long)until length bytes were transferred.- Parameters:
destChannel- The channel to write tosrcChannel- The channel to read fromdestOffset- The offset in the the destChannel where to add data from srcChannellength- The number of bytes to transfer from srcChannel to destChannel- Returns:
- The actual number of bytes transferred
- Throws:
IOException
-