/** * Constructor. * * @param stream The content stream to parse. * @throws IOException If there is an error initializing the stream. */ public PDFStreamParser(InputStream stream) throws IOException { super(new InputStreamSource(stream)); }
@Override public boolean isEOF() throws IOException { return peek() == -1; }
@Override public byte[] readFully(int length) throws IOException { byte[] bytes = new byte[length]; int off = 0; int len = length; while (len > 0) { int n = this.read(bytes, off, len); if (n > 0) { off += n; len -= n; position += n; } else { break; } } return bytes; }
/** * Constructor. * * @param bytes the bytes to parse. * @throws IOException If there is an error initializing the stream. */ public PDFStreamParser(byte[] bytes) throws IOException { super(new InputStreamSource(new ByteArrayInputStream(bytes))); }
@Override public boolean isEOF() throws IOException { return peek() == -1; }
@Override public byte[] readFully(int length) throws IOException { byte[] bytes = new byte[length]; int off = 0; int len = length; while (len > 0) { int n = this.read(bytes, off, len); off += n; len -= n; position += n; } return bytes; }
/** * Constructor. * * @param stream The stream to parse. * @param document The document for the current parsing. * @throws IOException If there is an error initializing the stream. */ public PDFObjectStreamParser(COSStream stream, COSDocument document) throws IOException { super(new InputStreamSource(stream.createInputStream())); this.stream = stream; this.document = document; }
@Override public boolean isEOF() throws IOException { return peek() == -1; }
@Override public byte[] readFully(int length) throws IOException { byte[] bytes = new byte[length]; int off = 0; int len = length; while (len > 0) { int n = this.read(bytes, off, len); if (n > 0) { off += n; len -= n; position += n; } else { break; } } return bytes; }
/** * Constructor. * * @param stream The stream to parse. * @param document The document for the current parsing. * @param resolver resolver to read the xref/trailer information * * @throws IOException If there is an error initializing the stream. */ public PDFXrefStreamParser(COSStream stream, COSDocument document, XrefTrailerResolver resolver) throws IOException { super(new InputStreamSource(stream.createInputStream())); this.stream = stream; this.document = document; this.xrefTrailerResolver = resolver; }
/** * Constructor. * * @param bytes the bytes to parse. * @throws IOException If there is an error initializing the stream. */ public PDFStreamParser(byte[] bytes) throws IOException { super(new InputStreamSource(new ByteArrayInputStream(bytes))); }
/** * Constructor. * * @param bytes the bytes to parse. * @throws IOException If there is an error initializing the stream. */ public PDFStreamParser(byte[] bytes) throws IOException { super(new InputStreamSource(new ByteArrayInputStream(bytes))); }
/** * Constructor. * * @param contentStream The content stream to parse. * @throws IOException If there is an error initializing the stream. */ public PDFStreamParser(PDContentStream contentStream) throws IOException { super(new InputStreamSource(contentStream.getContents())); }
/** * Constructor. * * @param stream The stream to parse. * @throws IOException If there is an error initializing the stream. * * @deprecated Use {@link PDFStreamParser#PDFStreamParser(PDContentStream)} instead. */ @Deprecated public PDFStreamParser(PDStream stream) throws IOException { super(new InputStreamSource(stream.createInputStream())); }
/** * Constructor. * * @param stream The stream to parse. * @throws IOException If there is an error initializing the stream. * * @deprecated Use {@link PDFStreamParser#PDFStreamParser(PDContentStream)} instead. */ @Deprecated public PDFStreamParser(COSStream stream) throws IOException { super(new InputStreamSource(stream.createInputStream())); }
/** * Constructor. * * @param contentStream The content stream to parse. * @throws IOException If there is an error initializing the stream. */ public PDFStreamParser(PDContentStream contentStream) throws IOException { super(new InputStreamSource(contentStream.getContents())); }
/** * Constructor. * * @param stream The stream to parse. * @throws IOException If there is an error initializing the stream. * * @deprecated Use {@link PDFStreamParser#PDFStreamParser(PDContentStream)} instead. */ @Deprecated public PDFStreamParser(PDStream stream) throws IOException { super(new InputStreamSource(stream.createInputStream())); }
/** * Constructor. * * @param stream The stream to parse. * @throws IOException If there is an error initializing the stream. * * @deprecated Use {@link PDFStreamParser#PDFStreamParser(PDContentStream)} instead. */ @Deprecated public PDFStreamParser(COSStream stream) throws IOException { super(new InputStreamSource(stream.createInputStream())); }
/** * Constructor. * * @param stream The stream to parse. * @param document The document for the current parsing. * @throws IOException If there is an error initializing the stream. */ public PDFObjectStreamParser(COSStream stream, COSDocument document) throws IOException { super(new InputStreamSource(stream.createInputStream())); this.stream = stream; this.document = document; }
/** * Constructor. * * @param stream The stream to parse. * @param document The document for the current parsing. * @throws IOException If there is an error initializing the stream. */ public PDFObjectStreamParser(COSStream stream, COSDocument document) throws IOException { super(new InputStreamSource(stream.createInputStream())); this.stream = stream; this.document = document; }