/** * Reads the next token skipping over the comments. * @return <CODE>true</CODE> if a token was read, <CODE>false</CODE> if the end of content was reached * @throws IOException on error */ public boolean nextValidToken() throws IOException { while (tokeniser.nextToken()) { if (tokeniser.getTokenType() == PdfTokenizer.TokenType.Comment) continue; return true; } return false; } }
/** * Reads the next token skipping over the comments. * @return {@code true} if a token was read, {@code false} if the end of content was reached. * @throws java.io.IOException on error. */ public boolean nextValidToken() throws java.io.IOException { while (tokeniser.nextToken()) { if (tokeniser.getTokenType() == TokenType.Comment) continue; return true; } return false; }
/** * Reads the next token skipping over the comments. * @return {@code true} if a token was read, {@code false} if the end of content was reached. * @throws java.io.IOException on error. */ public boolean nextValidToken() throws java.io.IOException { while (tokeniser.nextToken()) { if (tokeniser.getTokenType() == TokenType.Comment) continue; return true; } return false; }
/** * Check whether line starts with object declaration. * @param lineTokenizer tokenizer, built by single line. * @return object number and generation if check is successful, otherwise - null. */ public static int[] checkObjectStart(PdfTokenizer lineTokenizer) { try { lineTokenizer.seek(0); if (!lineTokenizer.nextToken() || lineTokenizer.getTokenType() != TokenType.Number) return null; int num = lineTokenizer.getIntValue(); if (!lineTokenizer.nextToken() || lineTokenizer.getTokenType() != TokenType.Number) return null; int gen = lineTokenizer.getIntValue(); if (!lineTokenizer.nextToken()) return null; if (!Arrays.equals(Obj, lineTokenizer.getByteContent())) return null; return new int[]{num, gen}; } catch (Exception ioe) { // empty on purpose } return null; }
/** * Check whether line starts with object declaration. * @param lineTokenizer tokenizer, built by single line. * @return object number and generation if check is successful, otherwise - null. */ public static int[] checkObjectStart(PdfTokenizer lineTokenizer) { try { lineTokenizer.seek(0); if (!lineTokenizer.nextToken() || lineTokenizer.getTokenType() != TokenType.Number) return null; int num = lineTokenizer.getIntValue(); if (!lineTokenizer.nextToken() || lineTokenizer.getTokenType() != TokenType.Number) return null; int gen = lineTokenizer.getIntValue(); if (!lineTokenizer.nextToken()) return null; if (!Arrays.equals(Obj, lineTokenizer.getByteContent())) return null; return new int[]{num, gen}; } catch (Exception ioe) { // empty on purpose } return null; }
Object[] ret = new Object[3]; try { while (tk.nextToken()) { if (tk.getTokenType() == PdfTokenizer.TokenType.Comment) continue;
Object[] ret = new Object[3]; try { while (tk.nextToken()) { if (tk.getTokenType() == PdfTokenizer.TokenType.Comment) continue;
byte[] n2 = null; long ptr = 0; while (nextToken()) { if (type == TokenType.Comment) continue;
byte[] n2 = null; long ptr = 0; while (nextToken()) { if (type == TokenType.Comment) continue;
protected void readXref() throws IOException { tokens.seek(tokens.getStartxref()); tokens.nextToken(); if (!tokens.tokenValueEqualsTo(PdfTokenizer.Startxref)) throw new PdfException(PdfException.PdfStartxrefNotFound, tokens); tokens.nextToken(); if (tokens.getTokenType() != PdfTokenizer.TokenType.Number) throw new PdfException(PdfException.PdfStartxrefIsNotFollowedByANumber, tokens);
protected boolean readXrefStream(long ptr) throws IOException { tokens.seek(ptr); if (!tokens.nextToken()) { return false; return false; if (!tokens.nextToken() || tokens.getTokenType() != PdfTokenizer.TokenType.Number) { return false; if (!tokens.nextToken() || !tokens.tokenValueEqualsTo(PdfTokenizer.Obj)) { return false;
continue; tokens.seek(pos); tokens.nextToken(); pos = tokens.getPosition(); try {
hasNext = tokens.nextToken(); } while (hasNext && tokens.getTokenType() == PdfTokenizer.TokenType.Comment);