Package com.pnfsoftware.jeb.util.io
Class ChannelUtil
java.lang.Object
com.pnfsoftware.jeb.util.io.ChannelUtil
Utility methods for
Channel
s, in particular, SeekableByteChannel
s.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte
get
(SeekableByteChannel channel) static byte
get
(SeekableByteChannel channel, long position) static byte[]
getAllFrom
(SeekableByteChannel channel, long position) static int
getBEInt
(SeekableByteChannel channel) static int
getBEInt
(SeekableByteChannel channel, long position) static long
getBELong
(SeekableByteChannel channel) static long
getBELong
(SeekableByteChannel channel, long position) static short
getBEShort
(SeekableByteChannel channel) static short
getBEShort
(SeekableByteChannel channel, long position) static byte[]
getBytes
(SeekableByteChannel channel, int size) static byte[]
getBytes
(SeekableByteChannel channel, long position, int size) static byte[]
getBytesUntil
(SeekableByteChannel channel, int stopper, int maxsize, boolean throwOnEOS) static int
getInt
(SeekableByteChannel channel, long position, ByteOrder endianness) static int
getInt
(SeekableByteChannel channel, ByteOrder endianness) static int
getLEInt
(SeekableByteChannel channel) static int
getLEInt
(SeekableByteChannel channel, long position) static long
getLELong
(SeekableByteChannel channel) static long
getLELong
(SeekableByteChannel channel, long position) static short
getLEShort
(SeekableByteChannel channel) static short
getLEShort
(SeekableByteChannel channel, long position) static long
getLong
(SeekableByteChannel channel, long position, ByteOrder endianness) static long
getLong
(SeekableByteChannel channel, ByteOrder endianness) static short
getShort
(SeekableByteChannel channel, long position, ByteOrder endianness) static short
getShort
(SeekableByteChannel channel, ByteOrder endianness) static ByteBuffer
read
(SeekableByteChannel channel, long position, int size, boolean isBigEndian) static ByteBuffer
read
(SeekableByteChannel channel, long position, int size, boolean isBigEndian, ByteBuffer buffer) static ByteBuffer
readBestEffort
(SeekableByteChannel channel, long position, int size, boolean isBigEndian, ByteBuffer buffer)
-
Constructor Details
-
ChannelUtil
public ChannelUtil()
-
-
Method Details
-
read
public static ByteBuffer read(SeekableByteChannel channel, long position, int size, boolean isBigEndian) throws IOException - Throws:
IOException
-
read
public static ByteBuffer read(SeekableByteChannel channel, long position, int size, boolean isBigEndian, ByteBuffer buffer) throws IOException - Throws:
IOException
-
readBestEffort
public static ByteBuffer readBestEffort(SeekableByteChannel channel, long position, int size, boolean isBigEndian, ByteBuffer buffer) throws IOException - Throws:
IOException
-
getAllFrom
- Throws:
IOException
-
get
- Throws:
IOException
-
get
- Throws:
IOException
-
getBytes
public static byte[] getBytes(SeekableByteChannel channel, long position, int size) throws IOException - Throws:
IOException
-
getBytes
- Throws:
IOException
-
getShort
public static short getShort(SeekableByteChannel channel, long position, ByteOrder endianness) throws IOException - Throws:
IOException
-
getInt
public static int getInt(SeekableByteChannel channel, long position, ByteOrder endianness) throws IOException - Throws:
IOException
-
getLong
public static long getLong(SeekableByteChannel channel, long position, ByteOrder endianness) throws IOException - Throws:
IOException
-
getShort
- Throws:
IOException
-
getInt
- Throws:
IOException
-
getLong
- Throws:
IOException
-
getLEShort
- Throws:
IOException
-
getLEInt
- Throws:
IOException
-
getLELong
- Throws:
IOException
-
getBEShort
- Throws:
IOException
-
getBEInt
- Throws:
IOException
-
getBELong
- Throws:
IOException
-
getLEShort
- Throws:
IOException
-
getLEInt
- Throws:
IOException
-
getLELong
- Throws:
IOException
-
getBEShort
- Throws:
IOException
-
getBEInt
- Throws:
IOException
-
getBELong
- Throws:
IOException
-
getBytesUntil
public static byte[] getBytesUntil(SeekableByteChannel channel, int stopper, int maxsize, boolean throwOnEOS) throws IOException - Throws:
IOException
-