Class ParseOps
- java.lang.Object
-
- com.adobe.internal.pdftoolkit.core.util.ParseOps
-
public final class ParseOps extends java.lang.ObjectThis class provides many utility methods related to parsing of stream.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static longgetEndObjPos(InputByteStream mBuf)Gets the position of endobj keyword in this stream.static byte[]readHex(InputByteStream buf)Parses a hexidecimal character string into a byte array.static byte[]readLiteral(InputByteStream inBuf)This API reads the literals and returns as byte array.static ASNamereadName(InputByteStream buf)Parses an atom from the PDF byte stream.static ASNumberreadNumber(byte first, InputByteStream buf)Parses a numerical value from the PDF byte stream.static voidskipHex(InputByteStream buf)Skips a hexidecimal character string.static voidskipLiteral(InputByteStream inBuf)This API skips all the literals in the stream passed.static voidskipName(InputByteStream buf)Skips an atom from the PDF byte stream.static voidskipNumber(byte first, InputByteStream buf)Skips over a numerical value from the PDF byte stream.static byteskipWhitespace(InputByteStream buf)Skips over whitespace in the input stream.
-
-
-
Method Detail
-
readHex
public static byte[] readHex(InputByteStream buf) throws java.io.IOException, PDFParseException
Parses a hexidecimal character string into a byte array. A pair of hex characters forms the value stored in a single byte of the array. Hexidecimal strings are defined in section 3.2.3 of the PDF Reference Manual version 1.4.- Parameters:
buf- Buffer to parse- Returns:
- Data corresponding to the hex string
- Throws:
java.io.IOExceptionPDFParseException- If there is a syntax error.
-
skipHex
public static void skipHex(InputByteStream buf) throws java.io.IOException, PDFParseException
Skips a hexidecimal character string. A pair of hex characters forms the value stored in a single byte of the array. Hexidecimal strings are defined in section 3.2.3 of the PDF Reference Manual version 1.4.- Parameters:
buf- Buffer to parse- Throws:
java.io.IOExceptionPDFParseException- If there is a syntax error.
-
skipLiteral
public static void skipLiteral(InputByteStream inBuf) throws java.io.IOException
This API skips all the literals in the stream passed.- Throws:
java.io.IOException
-
readLiteral
public static byte[] readLiteral(InputByteStream inBuf) throws java.io.IOException, PDFParseException
This API reads the literals and returns as byte array.- Throws:
PDFParseExceptionjava.io.IOException
-
readName
public static ASName readName(InputByteStream buf) throws java.io.IOException, PDFParseException
Parses an atom from the PDF byte stream. An atom can be thought of as a COS name as defined in section 3.2.4 of the PDF Reference Manual version 1.4.- Parameters:
buf- PDF data buffer to parse- Returns:
- ASName parsed from the buffer
- Throws:
java.io.IOExceptionPDFParseException
-
skipName
public static void skipName(InputByteStream buf) throws java.io.IOException, PDFParseException
Skips an atom from the PDF byte stream. An atom can be thought of as a COS name as defined in section 3.2.4 of the PDF Reference Manual version 1.4.- Parameters:
buf- PDF data buffer to parse- Throws:
java.io.IOExceptionPDFParseException
-
readNumber
public static ASNumber readNumber(byte first, InputByteStream buf) throws PDFParseException, java.io.IOException
Parses a numerical value from the PDF byte stream. A numeric object is defined in section 3.2.2 of the PDF Reference Manual version 1.4.- Parameters:
buf- Byte stream to parsefirst- Starting byte to parse- Returns:
- Parsed number.
- Throws:
java.io.IOExceptionPDFParseException
-
skipNumber
public static void skipNumber(byte first, InputByteStream buf) throws PDFParseException, java.io.IOExceptionSkips over a numerical value from the PDF byte stream. A numeric object is defined in section 3.2.2 of the PDF Reference Manual version 1.4.- Parameters:
buf- Byte stream to parsefirst- Starting byte to parse- Throws:
java.io.IOExceptionPDFParseException
-
skipWhitespace
public static byte skipWhitespace(InputByteStream buf) throws java.io.IOException
Skips over whitespace in the input stream. Whitespace is defined in section 3.1.1 of the PDF Reference Manual version 1.4. For the purposes of this method, comments are also considered whitespace.- Parameters:
buf- Buffer to parse- Returns:
- The first non-whitespace byte encountered.
- Throws:
java.io.IOException
-
getEndObjPos
public static long getEndObjPos(InputByteStream mBuf) throws java.io.IOException
Gets the position of endobj keyword in this stream. If EOL is encountered before finding "endobj" -1 will be returned.- Parameters:
mBuf-- Returns:
- long
- Throws:
java.io.IOException
-
-