Class DataUtils

java.lang.Object
org.pepsoft.util.DataUtils

public final class DataUtils extends Object
Utility methods for working with data.

Created by Pepijn on 9-3-2017.

  • Method Details

    • readUnsignedInt

      public static long readUnsignedInt(DataInput in) throws IOException
      Read an unsigned 32-bit integer from a data stream.
      Parameters:
      in - The stream to read from.
      Returns:
      The next four bytes in the stream as an unsigned 32-bit integer.
      Throws:
      IOException - If the stream throws an IOException while reading the bytes.
    • unpackDataArray

      public static long[][] unpackDataArray(Object data, int wordSize, int columnCount)
      Decode data that consists of a matrix of equally sized numbers packed into a one dimensional array.
      Parameters:
      data - The data array to unpack.
      wordSize - The word size in bits into which the numbers have been packed.
      columnCount - The number of words per line or row of the original matrix.
      Returns:
      The unpacked data.