Class Util

java.lang.Object
com.irurueta.geometry.io.Util

public class Util extends Object
Utility methods for I/O operations.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static double
    fromBigEndian(double value)
    Converts value from big endian to machine native endian type (in Java native endian type is always Big endian, for that reason this method has no effect).
    (package private) static float
    fromBigEndian(float value)
    Converts value from big endian to machine native endian type (in Java native endian type is always Big endian, for that reason this method has no effect).
    (package private) static int
    fromBigEndian(int value)
    Converts value from big endian to machine native endian type (in Java native endian type is always Big endian, for that reason this method has no effect).
    (package private) static long
    fromBigEndian(long value)
    Converts value from big endian to machine native endian type (in Java native endian type is always Big endian, for that reason this method has no effect).
    (package private) static short
    fromBigEndian(short value)
    Converts value from big endian to machine native endian type (in Java native endian type is always Big endian, for that reason this method has no effect).
    (package private) static double
    fromEndianType(EndianType endianType, double value)
    Converts provided value from provided endian type to machine native endian type (in Java native endian type is always big endian).
    (package private) static float
    fromEndianType(EndianType endianType, float value)
    Converts provided value from provided endian type to machine native endian type (in Java native endian type is always big endian).
    (package private) static int
    fromEndianType(EndianType endianType, int value)
    Converts provided value from provided endian type to machine native endian type (in Java native endian type is always big endian).
    (package private) static long
    fromEndianType(EndianType endianType, long value)
    Converts provided value from provided endian type to machine native endian type (in Java native endian type is always big endian).
    (package private) static short
    fromEndianType(EndianType endianType, short value)
    Converts provided value from provided endian type to machine native endian type (in Java native endian type is always big endian).
    (package private) static double
    fromLittleEndian(double value)
    Converts value from little endian to machine native endian type (in Java native endian type is always Big endian).
    (package private) static float
    fromLittleEndian(float value)
    Converts value from little endian to machine native endian type (in Java native endian type is always Big endian).
    (package private) static int
    fromLittleEndian(int value)
    Converts value from little endian to machine native endian type (in Java native endian type is always Big endian).
    (package private) static long
    fromLittleEndian(long value)
    Converts value from little endian to machine native endian type (in Java native endian type is always Big endian).
    (package private) static short
    fromLittleEndian(short value)
    Converts value from little endian to machine native endian type (in Java native endian type is always Big endian).
    (package private) static double
    toBigEndian(double value)
    Converts provided value to big endian.
    (package private) static float
    toBigEndian(float value)
    Converts provided value to big endian.
    (package private) static int
    toBigEndian(int value)
    Converts provided value to big endian.
    (package private) static long
    toBigEndian(long value)
    Converts provided value to big endian.
    (package private) static short
    toBigEndian(short value)
    Converts provided value to big endian.
    (package private) static double
    toEndianType(EndianType endianType, double value)
    Converts provided value to provided endian type.
    (package private) static float
    toEndianType(EndianType endianType, float value)
    Converts provided value to provided endian type.
    (package private) static int
    toEndianType(EndianType endianType, int value)
    Converts provided value to provided endian type.
    (package private) static long
    toEndianType(EndianType endianType, long value)
    Converts provided value to provided endian type.
    (package private) static short
    toEndianType(EndianType endianType, short value)
    Converts provided value to provided endian type.
    (package private) static double
    toLittleEndian(double value)
    Converts provided value to little endian.
    (package private) static float
    toLittleEndian(float value)
    Converts provided value to little endian.
    (package private) static int
    toLittleEndian(int value)
    Converts provided value to little endian.
    (package private) static long
    toLittleEndian(long value)
    Converts provided value to little endian.
    (package private) static short
    toLittleEndian(short value)
    Converts provided value to little endian.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Util

      private Util()
      Constructor. Prevents instantiation.
  • Method Details

    • toBigEndian

      static short toBigEndian(short value)
      Converts provided value to big endian. NOTE: Java virtual machine always uses big endian values, so this method has no effect.
      Parameters:
      value - Value to be converted to big endian.
      Returns:
      Converted value.
    • toLittleEndian

      static short toLittleEndian(short value)
      Converts provided value to little endian. Little endian puts high bytes last, or in other words, byte order is reversed.
      Parameters:
      value - Value to be converted to little endian.
      Returns:
      Converted value.
    • toEndianType

      static short toEndianType(EndianType endianType, short value)
      Converts provided value to provided endian type. Little endian puts high bytes last (having reversed byte order), and big endian puts high bytes first (following natural binary order).
      Parameters:
      endianType - Endian type.
      value - Value to be converted.
      Returns:
      Converted value.
    • fromBigEndian

      static short fromBigEndian(short value)
      Converts value from big endian to machine native endian type (in Java native endian type is always Big endian, for that reason this method has no effect).
      Parameters:
      value - Value to be converted.
      Returns:
      Converted value.
    • fromLittleEndian

      static short fromLittleEndian(short value)
      Converts value from little endian to machine native endian type (in Java native endian type is always Big endian). Little endian puts high bytes last, so byte order has to be reversed to convert to native machine endian type. Big endian preserves natural byte order (high bytes first).
      Parameters:
      value - Value to be converted.
      Returns:
      Converted value.
    • fromEndianType

      static short fromEndianType(EndianType endianType, short value)
      Converts provided value from provided endian type to machine native endian type (in Java native endian type is always big endian). Little endian puts high bytes last, so byte order has to be reversed to convert to native machine endian. Big endian preserves natural byte order (high bytes first).
      Parameters:
      endianType - Endian type.
      value - Value to be converted.
      Returns:
      Converted value.
    • toBigEndian

      static int toBigEndian(int value)
      Converts provided value to big endian. NOTE: Java virtual machine always uses big endian values, so this method has no effect.
      Parameters:
      value - Value to be converted to big endian.
      Returns:
      Converted value.
    • toLittleEndian

      static int toLittleEndian(int value)
      Converts provided value to little endian. Little endian puts high bytes last, or in other words, byte order is reversed.
      Parameters:
      value - Value to be converted to little endian.
      Returns:
      Converted value.
    • toEndianType

      static int toEndianType(EndianType endianType, int value)
      Converts provided value to provided endian type. Little endian puts high bytes last (having reversed byte order), and big endian puts high bytes first (following natural binary order).
      Parameters:
      endianType - Endian type.
      value - Value to be converted.
      Returns:
      Converted value.
    • fromBigEndian

      static int fromBigEndian(int value)
      Converts value from big endian to machine native endian type (in Java native endian type is always Big endian, for that reason this method has no effect).
      Parameters:
      value - Value to be converted.
      Returns:
      Converted value.
    • fromLittleEndian

      static int fromLittleEndian(int value)
      Converts value from little endian to machine native endian type (in Java native endian type is always Big endian). Little endian puts high bytes last, so byte order has to be reversed to convert to native machine endian type. Big endian preserves natural byte order (high bytes first).
      Parameters:
      value - Value to be converted.
      Returns:
      Converted value.
    • fromEndianType

      static int fromEndianType(EndianType endianType, int value)
      Converts provided value from provided endian type to machine native endian type (in Java native endian type is always big endian). Little endian puts high bytes last, so byte order has to be reversed to convert to native machine endian. Big endian preserves natural byte order (high bytes first).
      Parameters:
      endianType - Endian type.
      value - Value to be converted.
      Returns:
      Converted value.
    • toBigEndian

      static long toBigEndian(long value)
      Converts provided value to big endian. NOTE: Java virtual machine always uses big endian values, so this method has no effect.
      Parameters:
      value - Value to be converted to big endian.
      Returns:
      Converted value.
    • toLittleEndian

      static long toLittleEndian(long value)
      Converts provided value to little endian. Little endian puts high bytes last, or in other words, byte order is reversed.
      Parameters:
      value - Value to be converted to little endian.
      Returns:
      Converted value.
    • toEndianType

      static long toEndianType(EndianType endianType, long value)
      Converts provided value to provided endian type. Little endian puts high bytes last (having reversed byte order), and big endian puts high bytes first (following natural binary order).
      Parameters:
      endianType - Endian type.
      value - Value to be converted.
      Returns:
      Converted value.
    • fromBigEndian

      static long fromBigEndian(long value)
      Converts value from big endian to machine native endian type (in Java native endian type is always Big endian, for that reason this method has no effect).
      Parameters:
      value - Value to be converted.
      Returns:
      Converted value.
    • fromLittleEndian

      static long fromLittleEndian(long value)
      Converts value from little endian to machine native endian type (in Java native endian type is always Big endian). Little endian puts high bytes last, so byte order has to be reversed to convert to native machine endian type. Big endian preserves natural byte order (high bytes first).
      Parameters:
      value - Value to be converted.
      Returns:
      Converted value.
    • fromEndianType

      static long fromEndianType(EndianType endianType, long value)
      Converts provided value from provided endian type to machine native endian type (in Java native endian type is always big endian). Little endian puts high bytes last, so byte order has to be reversed to convert to native machine endian. Big endian preserves natural byte order (high bytes first).
      Parameters:
      endianType - Endian type.
      value - Value to be converted.
      Returns:
      Converted value.
    • toBigEndian

      static float toBigEndian(float value)
      Converts provided value to big endian. NOTE: Java virtual machine always uses big endian values, so this method has no effect.
      Parameters:
      value - Value to be converted to big endian.
      Returns:
      Converted value.
    • toLittleEndian

      static float toLittleEndian(float value)
      Converts provided value to little endian. Little endian puts high bytes last, or in other words, byte order is reversed.
      Parameters:
      value - Value to be converted to little endian.
      Returns:
      Converted value.
    • toEndianType

      static float toEndianType(EndianType endianType, float value)
      Converts provided value to provided endian type. Little endian puts high bytes last (having reversed byte order), and big endian puts high bytes first (following natural binary order).
      Parameters:
      endianType - Endian type.
      value - Value to be converted.
      Returns:
      Converted value.
    • fromBigEndian

      static float fromBigEndian(float value)
      Converts value from big endian to machine native endian type (in Java native endian type is always Big endian, for that reason this method has no effect).
      Parameters:
      value - Value to be converted.
      Returns:
      Converted value.
    • fromLittleEndian

      static float fromLittleEndian(float value)
      Converts value from little endian to machine native endian type (in Java native endian type is always Big endian). Little endian puts high bytes last, so byte order has to be reversed to convert to native machine endian type. Big endian preserves natural byte order (high bytes first).
      Parameters:
      value - Value to be converted.
      Returns:
      Converted value.
    • fromEndianType

      static float fromEndianType(EndianType endianType, float value)
      Converts provided value from provided endian type to machine native endian type (in Java native endian type is always big endian). Little endian puts high bytes last, so byte order has to be reversed to convert to native machine endian. Big endian preserves natural byte order (high bytes first).
      Parameters:
      endianType - Endian type.
      value - Value to be converted.
      Returns:
      Converted value.
    • toBigEndian

      static double toBigEndian(double value)
      Converts provided value to big endian. NOTE: Java virtual machine always uses big endian values, so this method has no effect.
      Parameters:
      value - Value to be converted to big endian.
      Returns:
      Converted value.
    • toLittleEndian

      static double toLittleEndian(double value)
      Converts provided value to little endian. Little endian puts high bytes last, or in other words, byte order is reversed.
      Parameters:
      value - Value to be converted to little endian.
      Returns:
      Converted value.
    • toEndianType

      static double toEndianType(EndianType endianType, double value)
      Converts provided value to provided endian type. Little endian puts high bytes last (having reversed byte order), and big endian puts high bytes first (following natural binary order).
      Parameters:
      endianType - Endian type.
      value - Value to be converted.
      Returns:
      Converted value.
    • fromBigEndian

      static double fromBigEndian(double value)
      Converts value from big endian to machine native endian type (in Java native endian type is always Big endian, for that reason this method has no effect).
      Parameters:
      value - Value to be converted.
      Returns:
      Converted value.
    • fromLittleEndian

      static double fromLittleEndian(double value)
      Converts value from little endian to machine native endian type (in Java native endian type is always Big endian). Little endian puts high bytes last, so byte order has to be reversed to convert to native machine endian type. Big endian preserves natural byte order (high bytes first).
      Parameters:
      value - Value to be converted.
      Returns:
      Converted value.
    • fromEndianType

      static double fromEndianType(EndianType endianType, double value)
      Converts provided value from provided endian type to machine native endian type (in Java native endian type is always big endian). Little endian puts high bytes last, so byte order has to be reversed to convert to native machine endian. Big endian preserves natural byte order (high bytes first).
      Parameters:
      endianType - Endian type.
      value - Value to be converted.
      Returns:
      Converted value.