public final class Channels
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static int |
readFromFileChannel(java.nio.channels.FileChannel channel,
long channelPosition,
byte[] dest,
int destOffset,
int length)
read length bytes from position of a file channel.
|
static int |
readFromFileChannel(java.nio.channels.FileChannel channel,
long channelPosition,
java.nio.ByteBuffer dest)
read from a file channel into a byte buffer, starting at a certain position.
|
static byte[] |
readFromFileChannel(java.nio.channels.FileChannel channel,
long position,
int length)
read length bytes from position of a file channel
|
static void |
readFromFileChannelWithEofException(java.nio.channels.FileChannel channel,
long channelPosition,
byte[] dest,
int destOffset,
int length)
read length bytes from position of a file channel.
|
static void |
readFromFileChannelWithEofException(java.nio.channels.FileChannel channel,
long channelPosition,
java.nio.ByteBuffer dest)
read from a file channel into a byte buffer, starting at a certain position.
|
static void |
writeToChannel(byte[] source,
int offset,
int length,
java.nio.channels.WritableByteChannel channel)
Writes part of a byte array to a
WritableByteChannel |
static void |
writeToChannel(byte[] source,
java.nio.channels.WritableByteChannel channel)
Writes part of a byte array to a
WritableByteChannel |
static void |
writeToChannel(java.nio.ByteBuffer byteBuffer,
java.nio.channels.WritableByteChannel channel)
Writes a
ByteBuffer to a WritableByteChannel |
public static byte[] readFromFileChannel(java.nio.channels.FileChannel channel,
long position,
int length)
throws java.io.IOException
java.io.IOExceptionpublic static void readFromFileChannelWithEofException(java.nio.channels.FileChannel channel,
long channelPosition,
byte[] dest,
int destOffset,
int length)
throws java.io.IOException
channel - channel to read fromchannelPosition - position to read fromdest - destination byte array to put data indestOffset - offset in dest to read intolength - number of bytes to readjava.io.IOExceptionpublic static int readFromFileChannel(java.nio.channels.FileChannel channel,
long channelPosition,
byte[] dest,
int destOffset,
int length)
throws java.io.IOException
channel - channel to read fromchannelPosition - position to read fromdest - destination byte array to put data indestOffset - offset in dest to read intolength - number of bytes to readjava.io.IOExceptionpublic static void readFromFileChannelWithEofException(java.nio.channels.FileChannel channel,
long channelPosition,
java.nio.ByteBuffer dest)
throws java.io.IOException
channel - channel to read fromchannelPosition - position to read fromdest - destination ByteBuffer to put data injava.io.IOExceptionpublic static int readFromFileChannel(java.nio.channels.FileChannel channel,
long channelPosition,
java.nio.ByteBuffer dest)
throws java.io.IOException
channel - channel to read fromchannelPosition - position to read fromdest - destination ByteBuffer to put data injava.io.IOExceptionpublic static void writeToChannel(byte[] source,
java.nio.channels.WritableByteChannel channel)
throws java.io.IOException
WritableByteChannelsource - byte array to copy fromchannel - target WritableByteChanneljava.io.IOExceptionpublic static void writeToChannel(byte[] source,
int offset,
int length,
java.nio.channels.WritableByteChannel channel)
throws java.io.IOException
WritableByteChannelsource - byte array to copy fromoffset - start copying from this offsetlength - how many bytes to copychannel - target WritableByteChanneljava.io.IOExceptionpublic static void writeToChannel(java.nio.ByteBuffer byteBuffer,
java.nio.channels.WritableByteChannel channel)
throws java.io.IOException
ByteBuffer to a WritableByteChannelbyteBuffer - source bufferchannel - channel to write tojava.io.IOException