Package com.sun.pdfview.decode
Class ASCII85Decode
- java.lang.Object
-
- com.sun.pdfview.decode.ASCII85Decode
-
public class ASCII85Decode extends java.lang.Object
decode ASCII85 text into a byte array.
-
-
Field Summary
Fields Modifier and Type Field Description private java.nio.ByteBuffer
buf
-
Constructor Summary
Constructors Modifier Constructor Description private
ASCII85Decode(java.nio.ByteBuffer buf)
initialize the decoder with byte buffer in ASCII85 format
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.nio.ByteBuffer
decode()
decode the bytesstatic java.nio.ByteBuffer
decode(java.nio.ByteBuffer buf, PDFObject params)
decode an array of bytes in ASCII85 format.private boolean
decode5(java.io.ByteArrayOutputStream baos)
decode the next five ASCII85 characters into up to four decoded bytes.private int
nextChar()
get the next character from the input.
-
-
-
Method Detail
-
nextChar
private int nextChar()
get the next character from the input.- Returns:
- the next character, or -1 if at end of stream
-
decode5
private boolean decode5(java.io.ByteArrayOutputStream baos) throws PDFParseException
decode the next five ASCII85 characters into up to four decoded bytes. Return false when finished, or true otherwise.- Parameters:
baos
- the ByteArrayOutputStream to write output to, set to the correct position- Returns:
- false when finished, or true otherwise.
- Throws:
PDFParseException
-
decode
private java.nio.ByteBuffer decode() throws PDFParseException
decode the bytes- Returns:
- the decoded bytes
- Throws:
PDFParseException
-
decode
public static java.nio.ByteBuffer decode(java.nio.ByteBuffer buf, PDFObject params) throws PDFParseException
decode an array of bytes in ASCII85 format.In ASCII85 format, every 5 characters represents 4 decoded bytes in base 85. The entire stream can contain whitespace, and ends in the characters '~>'.
- Parameters:
buf
- the encoded ASCII85 characters in a byte bufferparams
- parameters to the decoder (ignored)- Returns:
- the decoded bytes
- Throws:
PDFParseException
-
-