Class Utility


  • public class Utility
    extends java.lang.Object
    Utility.java Created: Fri Apr 2 14:28:55 1999
    • Constructor Summary

      Constructors 
      Constructor Description
      Utility()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean areContiguous​(DataRecord first, DataRecord second)  
      static java.util.List<java.util.List<DataRecord>> breakContiguous​(java.util.List<DataRecord> inList)
      breaks the List into sublists where the DataRecords are contiguous.
      static double bytesToDouble​(byte[] info, int start, boolean swapBytes)  
      static double bytesToDouble​(byte a, byte b, byte c, byte d, byte e, byte f, byte g, byte h, boolean swapBytes)  
      static float bytesToFloat​(byte[] info, int start, boolean swapBytes)  
      static float bytesToFloat​(byte a, byte b, byte c, byte d, boolean swapBytes)  
      static int bytesToInt​(byte a)  
      static int bytesToInt​(byte[] info, int start, boolean swapBytes)  
      static int bytesToInt​(byte a, byte b, boolean swapBytes)  
      static int bytesToInt​(byte a, byte b, byte c, boolean swapBytes)  
      static int bytesToInt​(byte a, byte b, byte c, byte d, boolean swapBytes)  
      static long bytesToLong​(byte[] info, int start, boolean swapBytes)  
      static long bytesToLong​(byte a, byte b, byte c, byte d, byte e, byte f, byte g, byte h, boolean swapBytes)  
      static short bytesToShort​(byte hi, byte low, boolean swapBytes)  
      static void cleanDuplicatesOverlaps​(java.util.List<DataRecord> drFromFileList)  
      static byte[] doubleToByteArray​(double d)  
      static int extractInteger​(byte[] info, int start, int length)  
      static java.lang.String extractNullTermString​(byte[] info, int start, int maxLength)  
      static java.lang.String extractString​(byte[] info, int start, int length)  
      static java.lang.String extractVarString​(byte[] info, int start, int maxLength)  
      static byte[] floatToByteArray​(float a)  
      static byte[] format​(byte[] source, int start, int end)  
      static void insertFloat​(float value, byte[] dest, int pos)
      Inserts float into dest at index pos
      static byte[] intToByteArray​(int a)  
      static byte[] longToByteArray​(long a)  
      static void main​(java.lang.String[] args)  
      static byte[] pad​(byte[] source, int requiredBytes, byte paddingByte)  
      static int uBytesToInt​(byte a)  
      static int uBytesToInt​(byte a, byte b, boolean swapBytes)  
      static void writeNullTermString​(java.lang.String value, int maxLength, java.io.DataOutput out)  
      • Methods inherited from class java.lang.Object

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

      • Utility

        public Utility()
    • Method Detail

      • extractInteger

        public static int extractInteger​(byte[] info,
                                         int start,
                                         int length)
      • extractString

        public static java.lang.String extractString​(byte[] info,
                                                     int start,
                                                     int length)
      • extractVarString

        public static java.lang.String extractVarString​(byte[] info,
                                                        int start,
                                                        int maxLength)
      • extractNullTermString

        public static java.lang.String extractNullTermString​(byte[] info,
                                                             int start,
                                                             int maxLength)
      • writeNullTermString

        public static void writeNullTermString​(java.lang.String value,
                                               int maxLength,
                                               java.io.DataOutput out)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • bytesToShort

        public static short bytesToShort​(byte hi,
                                         byte low,
                                         boolean swapBytes)
      • bytesToInt

        public static int bytesToInt​(byte a)
      • uBytesToInt

        public static int uBytesToInt​(byte a)
      • bytesToInt

        public static int bytesToInt​(byte[] info,
                                     int start,
                                     boolean swapBytes)
      • bytesToLong

        public static long bytesToLong​(byte[] info,
                                       int start,
                                       boolean swapBytes)
      • bytesToInt

        public static int bytesToInt​(byte a,
                                     byte b,
                                     boolean swapBytes)
      • uBytesToInt

        public static int uBytesToInt​(byte a,
                                      byte b,
                                      boolean swapBytes)
      • bytesToInt

        public static int bytesToInt​(byte a,
                                     byte b,
                                     byte c,
                                     boolean swapBytes)
      • bytesToInt

        public static int bytesToInt​(byte a,
                                     byte b,
                                     byte c,
                                     byte d,
                                     boolean swapBytes)
      • bytesToLong

        public static long bytesToLong​(byte a,
                                       byte b,
                                       byte c,
                                       byte d,
                                       byte e,
                                       byte f,
                                       byte g,
                                       byte h,
                                       boolean swapBytes)
      • bytesToFloat

        public static float bytesToFloat​(byte a,
                                         byte b,
                                         byte c,
                                         byte d,
                                         boolean swapBytes)
      • bytesToDouble

        public static double bytesToDouble​(byte a,
                                           byte b,
                                           byte c,
                                           byte d,
                                           byte e,
                                           byte f,
                                           byte g,
                                           byte h,
                                           boolean swapBytes)
      • bytesToDouble

        public static double bytesToDouble​(byte[] info,
                                           int start,
                                           boolean swapBytes)
      • bytesToFloat

        public static float bytesToFloat​(byte[] info,
                                         int start,
                                         boolean swapBytes)
      • intToByteArray

        public static byte[] intToByteArray​(int a)
      • floatToByteArray

        public static byte[] floatToByteArray​(float a)
      • longToByteArray

        public static byte[] longToByteArray​(long a)
      • doubleToByteArray

        public static byte[] doubleToByteArray​(double d)
      • insertFloat

        public static void insertFloat​(float value,
                                       byte[] dest,
                                       int pos)
        Inserts float into dest at index pos
      • pad

        public static byte[] pad​(byte[] source,
                                 int requiredBytes,
                                 byte paddingByte)
      • format

        public static byte[] format​(byte[] source,
                                    int start,
                                    int end)
      • breakContiguous

        public static java.util.List<java.util.List<DataRecord>> breakContiguous​(java.util.List<DataRecord> inList)
        breaks the List into sublists where the DataRecords are contiguous. Assumes that the input List is sorted (by begin time?) and does not contain overlaps.
      • main

        public static void main​(java.lang.String[] args)
      • cleanDuplicatesOverlaps

        public static void cleanDuplicatesOverlaps​(java.util.List<DataRecord> drFromFileList)