public final class BinaryUtils extends Object
Modifier and Type | Method and Description |
---|---|
static void |
readBuffer(FileChannel chan,
ByteBuffer buf,
long pos)
Read a buffer completely from a position in a file.
|
static void |
readBuffer(ReadableByteChannel chan,
ByteBuffer buf)
Read a buffer completely from a channel.
|
static void |
writeBuffer(FileChannel chan,
ByteBuffer buf,
long pos)
Write a buffer completely to a position in a file.
|
static void |
writeBuffer(WritableByteChannel chan,
ByteBuffer buf)
Write a buffer completely to the channel.
|
public static void readBuffer(ReadableByteChannel chan, ByteBuffer buf) throws IOException
Read a buffer completely from a channel.
chan
- The channel.buf
- The buffer.IOException
- If an error occurs while read the buffer.public static void readBuffer(FileChannel chan, ByteBuffer buf, long pos) throws IOException
Read a buffer completely from a position in a file.
chan
- The channel.buf
- The buffer.pos
- The position from which to read.IOException
- If an error occurs while read the buffer.public static void writeBuffer(WritableByteChannel chan, ByteBuffer buf) throws IOException
Write a buffer completely to the channel.
buf
- The buffer.IOException
- If an error occurs while writing the buffer.public static void writeBuffer(FileChannel chan, ByteBuffer buf, long pos) throws IOException
Write a buffer completely to a position in a file.
chan
- The channel.buf
- The buffer.pos
- The position from which to read.IOException
- If an error occurs while read the buffer.