Class ParserUtils


  • public class ParserUtils
    extends Object
    • Constructor Detail

      • ParserUtils

        public ParserUtils()
    • Method Detail

      • parseInteger

        public static long parseInteger​(InputStream inputStream,
                                        int size)
                                 throws IOException
        method used to parse : int, uint and date
        Parameters:
        inputStream - - stream to get value
        size - - size of the value in bytes
        Returns:
        - parsed value as long
        Throws:
        IOException - - in case of IO error
      • parseString

        public static String parseString​(InputStream inputStream,
                                         int size)
                                  throws IOException
        method used to parse string
        Parameters:
        inputStream - - stream to get value
        size - - size of the value in bytes
        Returns:
        - parsed value as String
        Throws:
        IOException - - in case of IO error
      • parseFloat

        public static double parseFloat​(InputStream inputStream,
                                        int size)
                                 throws IOException
        method used to parse float and double
        Parameters:
        inputStream - - stream to get value
        size - - size of the value in bytes
        Returns:
        - parsed value as double
        Throws:
        IOException - - in case of IO error
      • parseBinary

        public static byte[] parseBinary​(InputStream inputStream,
                                         int size)
                                  throws IOException
        method to parse byte array
        Parameters:
        inputStream - - stream to get value
        size - - size of the value in bytes
        Returns:
        - parsed value as array of bytes
        Throws:
        IOException - - in case of IO error
      • readVINT

        public static VINT readVINT​(InputStream inputStream)
                             throws IOException
        method to parse VINT
        Parameters:
        inputStream - - stream to get value
        Returns:
        - parsed value
        Throws:
        IOException - - in case of IO error
      • getBytes

        public static byte[] getBytes​(long val,
                                      long size)
        method to encode long as byte array of given size
        Parameters:
        val - - value to encode
        size - - size
        Returns:
        - byte array
      • skip

        public static void skip​(long size,
                                InputStream input)
                         throws IOException
        method to skip given amount of bytes in stream
        Parameters:
        size - - size to skip
        input - - input stream to process
        Throws:
        IOException - - in case of IO error