Class Bufs

java.lang.Object
uk.ac.bristol.star.cdf.record.Bufs

public class Bufs extends Object
Factory and utility methods for use with Bufs.
Since:
21 Jun 2013
  • Method Details

    • createBuf

      public static Buf createBuf(ByteBuffer byteBuffer, boolean isBit64, boolean isBigendian)
      Creates a buf based on a single NIO buffer.
      Parameters:
      byteBuffer - NIO buffer containing data
      isBit64 - 64bit-ness of buf
      isBigendian - true for big-endian data, false for little-endian
    • createBuf

      public static Buf createBuf(ByteBuffer[] byteBuffers, boolean isBit64, boolean isBigendian)
      Creates a buf based on a sequence of NIO buffers.
      Parameters:
      byteBuffers - array of NIO buffers containing data
      isBit64 - 64bit-ness of buf
      isBigendian - true for big-endian data, false for little-endian
    • createBuf

      public static Buf createBuf(File file, boolean isBit64, boolean isBigendian) throws IOException
      Creates a buf based on a file.
      Parameters:
      file - file containing data
      isBit64 - 64bit-ness of buf
      isBigendian - 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 format
      inBuf - buffer containing input compressed data
      inOffset - offset into inBuf at which the compressed data starts
      outSize - byte count of the uncompressed data
      Returns:
      new buffer of size outSize containing uncompressed data
      Throws:
      IOException
    • createByteBufferInputStream

      public static InputStream createByteBufferInputStream(ByteBuffer bbuf)
      Utility method to acquire the data from an NIO buffer in the form of an InputStream.
      Parameters:
      bbuf - NIO buffer
      Returns:
      stream