Package org.red5.io.matroska
Class ParserUtils
- java.lang.Object
-
- org.red5.io.matroska.ParserUtils
-
public class ParserUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static intBIT_IN_BYTE
-
Constructor Summary
Constructors Constructor Description ParserUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]getBytes(long val, long size)method to encode long as byte array of given sizestatic byte[]parseBinary(InputStream inputStream, int size)method to parse byte arraystatic doubleparseFloat(InputStream inputStream, int size)method used to parse float and doublestatic longparseInteger(InputStream inputStream, int size)method used to parse : int, uint and datestatic ArrayList<Tag>parseMasterElement(InputStream inputStream, int size)method used to parse subelements ofCompoundTagstatic StringparseString(InputStream inputStream, int size)method used to parse stringstatic TagparseTag(InputStream inputStream)parsing tag by matroska specification matroska spec tag = VINT id, VINT size, datastatic VINTreadVINT(InputStream inputStream)method to parseVINTstatic voidskip(long size, InputStream input)method to skip given amount of bytes in stream
-
-
-
Field Detail
-
BIT_IN_BYTE
public static final int BIT_IN_BYTE
- See Also:
- Constant Field Values
-
-
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 valuesize- - 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 valuesize- - 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 valuesize- - size of the value in bytes- Returns:
- - parsed value as double
- Throws:
IOException- - in case of IO error
-
parseMasterElement
public static ArrayList<Tag> parseMasterElement(InputStream inputStream, int size) throws IOException, ConverterException
method used to parse subelements ofCompoundTag- Parameters:
inputStream- - stream to get valuesize- - size of the value in bytes- Returns:
- - parsed tag
- Throws:
IOException- - in case of IO errorConverterException- - in case of any conversion exception
-
parseBinary
public static byte[] parseBinary(InputStream inputStream, int size) throws IOException
method to parse byte array- Parameters:
inputStream- - stream to get valuesize- - 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 parseVINT- Parameters:
inputStream- - stream to get value- Returns:
- - parsed value
- Throws:
IOException- - in case of IO error
-
parseTag
public static Tag parseTag(InputStream inputStream) throws IOException, ConverterException
parsing tag by matroska specification matroska spec tag = VINT id, VINT size, data- Parameters:
inputStream- - stream to get value- Returns:
- tag, without parsing tag data, because it delegate to an tag itself
- Throws:
IOException- - in case of IO errorConverterException- - in case of any conversion exception
-
getBytes
public static byte[] getBytes(long val, long size)method to encode long as byte array of given size- Parameters:
val- - value to encodesize- - size- Returns:
- - byte array
-
skip
public static void skip(long size, InputStream input) throws IOExceptionmethod to skip given amount of bytes in stream- Parameters:
size- - size to skipinput- - input stream to process- Throws:
IOException- - in case of IO error
-
-