/** * This will parse all the tokens in the stream. This will close the stream when it is finished * parsing. You can then access these with {@link #getTokens() getTokens()}. * * @throws IOException If there is an error while parsing the stream. */ public void parse() throws IOException { Object token; while( (token = parseNextToken()) != null ) { streamObjects.add( token ); } }
/** * Processes the operators of the given content stream. * * @param content the content to parse. * @throws IOException if there is an error reading or parsing the content stream. */ private void processAppearanceStringOperators(byte[] content) throws IOException { List<COSBase> arguments = new ArrayList<>(); PDFStreamParser parser = new PDFStreamParser(content); Object token = parser.parseNextToken(); while (token != null) { if (token instanceof COSObject) { arguments.add(((COSObject) token).getObject()); } else if (token instanceof Operator) { processOperator((Operator) token, arguments); arguments = new ArrayList<>(); } else { arguments.add((COSBase) token); } token = parser.parseNextToken(); } }
private static List<Object> createTokensWithoutText(PDContentStream contentStream) throws IOException Object token = parser.parseNextToken(); List<Object> newTokens = new ArrayList<>(); while (token != null) token = parser.parseNextToken(); continue; newTokens.remove(newTokens.size() - 1); token = parser.parseNextToken(); continue; token = parser.parseNextToken();
/** * Get the width from a type3 charproc stream. * * @return the glyph width. * @throws IOException if the stream could not be read, or did not have d0 or d1 as first * operator, or if their first argument was not a number. */ public float getWidth() throws IOException { List<COSBase> arguments = new ArrayList<>(); PDFStreamParser parser = new PDFStreamParser(getContents()); Object token = parser.parseNextToken(); while (token != null) { if (token instanceof COSObject) { arguments.add(((COSObject) token).getObject()); } else if (token instanceof Operator) { return parseWidth((Operator) token, arguments); } else { arguments.add((COSBase) token); } token = parser.parseNextToken(); } throw new IOException("Unexpected end of stream"); }
/** * Processes the operators of the given content stream. * * @param contentStream to content stream to parse. * @throws IOException if there is an error reading or parsing the content stream. */ private void processStreamOperators(PDContentStream contentStream) throws IOException { List<COSBase> arguments = new ArrayList<>(); PDFStreamParser parser = new PDFStreamParser(contentStream.getContents()); Object token = parser.parseNextToken(); while (token != null) { if (token instanceof COSObject) { arguments.add(((COSObject) token).getObject()); } else if (token instanceof Operator) { processOperator((Operator) token, arguments); arguments = new ArrayList<>(); } else { arguments.add((COSBase) token); } token = parser.parseNextToken(); } }
Object token = parser.parseNextToken(); while (token != null) token = parser.parseNextToken();
COSArray colors = null; Operator graphicOp = null; for (Object token = parser.parseNextToken(); token != null; token = parser.parseNextToken())
COSArray arguments = new COSArray(); COSArray fontArguments = new COSArray(); for (Object token = parser.parseNextToken(); token != null; token = parser.parseNextToken())
beginImageOP.setImageParameters( imageParams ); Object nextToken = null; while( (nextToken = parseNextToken()) instanceof COSName ) Object value = parseNextToken(); imageParams.setItem( (COSName)nextToken, (COSBase)value );
/** * This will parse all the tokens in the stream. This will close the stream when it is finished * parsing. You can then access these with {@link #getTokens() getTokens()}. * * @throws IOException If there is an error while parsing the stream. */ public void parse() throws IOException { Object token; while( (token = parseNextToken()) != null ) { streamObjects.add( token ); } }
/** * This will parse all the tokens in the stream. This will close the stream when it is finished * parsing. You can then access these with {@link #getTokens() getTokens()}. * * @throws IOException If there is an error while parsing the stream. */ public void parse() throws IOException { Object token; while( (token = parseNextToken()) != null ) { streamObjects.add( token ); } }
/** * Processes the operators of the given content stream. * * @param content the content to parse. * @throws IOException if there is an error reading or parsing the content stream. */ private void processAppearanceStringOperators(byte[] content) throws IOException { List<COSBase> arguments = new ArrayList<COSBase>(); PDFStreamParser parser = new PDFStreamParser(content); Object token = parser.parseNextToken(); while (token != null) { if (token instanceof COSObject) { arguments.add(((COSObject) token).getObject()); } else if (token instanceof Operator) { processOperator((Operator) token, arguments); arguments = new ArrayList<COSBase>(); } else { arguments.add((COSBase) token); } token = parser.parseNextToken(); } }
private static List<Object> createTokensWithoutText(PDContentStream contentStream) throws IOException Object token = parser.parseNextToken(); List<Object> newTokens = new ArrayList<Object>(); while (token != null) token = parser.parseNextToken(); continue; newTokens.remove(newTokens.size() - 1); token = parser.parseNextToken(); continue; token = parser.parseNextToken();
/** * Processes the operators of the given content stream. * * @param contentStream to content stream to parse. * @throws IOException if there is an error reading or parsing the content stream. */ private void processStreamOperators(PDContentStream contentStream) throws IOException { List<COSBase> arguments = new ArrayList<COSBase>(); PDFStreamParser parser = new PDFStreamParser(contentStream); Object token = parser.parseNextToken(); while (token != null) { if (token instanceof COSObject) { arguments.add(((COSObject) token).getObject()); } else if (token instanceof Operator) { processOperator((Operator) token, arguments); arguments = new ArrayList<COSBase>(); } else { arguments.add((COSBase) token); } token = parser.parseNextToken(); } }
/** * Get the width from a type3 charproc stream. * * @return the glyph width. * @throws IOException if the stream could not be read, or did not have d0 or d1 as first * operator, or if their first argument was not a number. */ public float getWidth() throws IOException { List<COSBase> arguments = new ArrayList<COSBase>(); PDFStreamParser parser = new PDFStreamParser(this); Object token = parser.parseNextToken(); while (token != null) { if (token instanceof COSObject) { arguments.add(((COSObject) token).getObject()); } else if (token instanceof Operator) { return parseWidth((Operator) token, arguments); } else { arguments.add((COSBase) token); } token = parser.parseNextToken(); } throw new IOException("Unexpected end of stream"); }
/** * Processes the operators of the given content stream. * * @param content the content to parse. * @throws IOException if there is an error reading or parsing the content stream. */ private void processAppearanceStringOperators(byte[] content) throws IOException { List<COSBase> arguments = new ArrayList<>(); PDFStreamParser parser = new PDFStreamParser(content); Object token = parser.parseNextToken(); while (token != null) { if (token instanceof COSObject) { arguments.add(((COSObject) token).getObject()); } else if (token instanceof Operator) { processOperator((Operator) token, arguments); arguments = new ArrayList<>(); } else { arguments.add((COSBase) token); } token = parser.parseNextToken(); } }
/** * Get the width from a type3 charproc stream. * * @return the glyph width. * @throws IOException if the stream could not be read, or did not have d0 or d1 as first * operator, or if their first argument was not a number. */ public float getWidth() throws IOException { List<COSBase> arguments = new ArrayList<>(); PDFStreamParser parser = new PDFStreamParser(this); Object token = parser.parseNextToken(); while (token != null) { if (token instanceof COSObject) { arguments.add(((COSObject) token).getObject()); } else if (token instanceof Operator) { return parseWidth((Operator) token, arguments); } else { arguments.add((COSBase) token); } token = parser.parseNextToken(); } throw new IOException("Unexpected end of stream"); }
final Clock clock = Clock.systemUTC(); final long startTime = clock.millis(); Object token = parser.parseNextToken(); while (token != null) throw new PdfTimeoutException(); token = parser.parseNextToken();
Object token = parser.parseNextToken(); while (token != null) token = parser.parseNextToken();
Object token = parser.parseNextToken(); while (token != null) token = parser.parseNextToken();