Package uk.ac.bristol.star.cdf.record
Class Bufs
java.lang.Object
uk.ac.bristol.star.cdf.record.Bufs
Factory and utility methods for use with Bufs.
- Since:
- 21 Jun 2013
-
Method Summary
Modifier and TypeMethodDescriptionstatic BufCreates a buf based on a file.static BufcreateBuf(ByteBuffer[] byteBuffers, boolean isBit64, boolean isBigendian) Creates a buf based on a sequence of NIO buffers.static BufcreateBuf(ByteBuffer byteBuffer, boolean isBit64, boolean isBigendian) Creates a buf based on a single NIO buffer.static InputStreamUtility method to acquire the data from an NIO buffer in the form of an InputStream.static Bufuncompress(Compression compression, Buf inBuf, long inOffset, long outSize) Decompresses part of an input Buf into an output Buf.
-
Method Details
-
createBuf
Creates a buf based on a single NIO buffer.- Parameters:
byteBuffer- NIO buffer containing dataisBit64- 64bit-ness of bufisBigendian- true for big-endian data, false for little-endian
-
createBuf
Creates a buf based on a sequence of NIO buffers.- Parameters:
byteBuffers- array of NIO buffers containing dataisBit64- 64bit-ness of bufisBigendian- true for big-endian data, false for little-endian
-
createBuf
Creates a buf based on a file.- Parameters:
file- file containing dataisBit64- 64bit-ness of bufisBigendian- true for big-endian data, false for little-endian- Throws:
IOException
-
uncompress
public static Buf uncompress(Compression compression, Buf inBuf, long inOffset, long outSize) throws IOException Decompresses part of an input Buf into an output Buf.- Parameters:
compression- compression formatinBuf- buffer containing input compressed datainOffset- offset intoinBufat which the compressed data startsoutSize- byte count of the uncompressed data- Returns:
- new buffer of size
outSizecontaining uncompressed data - Throws:
IOException
-
createByteBufferInputStream
Utility method to acquire the data from an NIO buffer in the form of an InputStream.- Parameters:
bbuf- NIO buffer- Returns:
- stream
-