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
IOException
public 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 readIOException
public 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 readIOException
public 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 inIOException
public 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 inIOException
public static void writeToChannel(org.jboss.netty.buffer.ChannelBuffer source, int sourceIndex, int length, GatheringByteChannel channel) throws IOException
ChannelBuffer
to a GatheringByteChannel
source
- ChannelBuffer to copy fromsourceIndex
- index in source to start copying fromlength
- how many bytes to copychannel
- target GatheringByteChannelIOException
public static void writeToChannel(byte[] source, WritableByteChannel channel) throws IOException
WritableByteChannel
source
- byte array to copy fromchannel
- target WritableByteChannelIOException
public static void writeToChannel(byte[] source, int offset, int length, WritableByteChannel channel) throws IOException
WritableByteChannel
source
- byte array to copy fromoffset
- start copying from this offsetlength
- how many bytes to copychannel
- target WritableByteChannelIOException
public static void writeToChannel(ByteBuffer byteBuffer, WritableByteChannel channel) throws IOException
ByteBuffer
to a WritableByteChannel
byteBuffer
- source bufferchannel
- channel to write toIOException
Copyright © 2009–2016. All rights reserved.