public final class Channels extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
readFromFileChannel(FileChannel channel,
long channelPosition,
byte[] dest,
int destOffset,
int length)
read length bytes from position of a file channel.
|
static int |
readFromFileChannel(FileChannel channel,
long channelPosition,
ByteBuffer dest)
read from a file channel into a byte buffer, starting at a certain position.
|
static byte[] |
readFromFileChannel(FileChannel channel,
long position,
int length)
read length bytes from position of a file channel
|
static void |
readFromFileChannelWithEofException(FileChannel channel,
long channelPosition,
byte[] dest,
int destOffset,
int length)
read length bytes from position of a file channel.
|
static void |
readFromFileChannelWithEofException(FileChannel channel,
long channelPosition,
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,
WritableByteChannel channel)
Writes part of a byte array to a
WritableByteChannel |
static void |
writeToChannel(byte[] source,
WritableByteChannel channel)
Writes part of a byte array to a
WritableByteChannel |
static void |
writeToChannel(ByteBuffer byteBuffer,
WritableByteChannel channel)
Writes a
ByteBuffer to a WritableByteChannel |
static void |
writeToChannel(org.jboss.netty.buffer.ChannelBuffer source,
int sourceIndex,
int length,
GatheringByteChannel channel)
Copies bytes from source
ChannelBuffer to a GatheringByteChannel |
public static byte[] readFromFileChannel(FileChannel channel, long position, int length) throws IOException
IOExceptionpublic static void readFromFileChannelWithEofException(FileChannel channel, long channelPosition, byte[] dest, int destOffset, int length) throws 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 readIOExceptionpublic static int readFromFileChannel(FileChannel channel, long channelPosition, byte[] dest, int destOffset, int length) throws 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 readIOExceptionpublic static void readFromFileChannelWithEofException(FileChannel channel, long channelPosition, ByteBuffer dest) throws IOException
channel - channel to read fromchannelPosition - position to read fromdest - destination ByteBuffer to put data inIOExceptionpublic static int readFromFileChannel(FileChannel channel, long channelPosition, ByteBuffer dest) throws IOException
channel - channel to read fromchannelPosition - position to read fromdest - destination ByteBuffer to put data inIOExceptionpublic static void writeToChannel(org.jboss.netty.buffer.ChannelBuffer source,
int sourceIndex,
int length,
GatheringByteChannel channel)
throws IOException
ChannelBuffer to a GatheringByteChannelsource - ChannelBuffer to copy fromsourceIndex - index in source to start copying fromlength - how many bytes to copychannel - target GatheringByteChannelIOExceptionpublic static void writeToChannel(byte[] source,
WritableByteChannel channel)
throws IOException
WritableByteChannelsource - byte array to copy fromchannel - target WritableByteChannelIOExceptionpublic static void writeToChannel(byte[] source,
int offset,
int length,
WritableByteChannel channel)
throws IOException
WritableByteChannelsource - byte array to copy fromoffset - start copying from this offsetlength - how many bytes to copychannel - target WritableByteChannelIOExceptionpublic static void writeToChannel(ByteBuffer byteBuffer, WritableByteChannel channel) throws IOException
ByteBuffer to a WritableByteChannelbyteBuffer - source bufferchannel - channel to write toIOExceptionCopyright © 2009–2017. All rights reserved.