public String readString(int size) throws java.io.IOException { StringBuilder buf = new StringBuilder(); int ch; while ((size--) > 0) { ch = read(); if (ch == -1) break; buf.append((char) ch); } return buf.toString(); }
public String readString(int size) throws java.io.IOException { StringBuilder buf = new StringBuilder(); int ch; while ((size--) > 0) { ch = read(); if (ch == -1) break; buf.append((char) ch); } return buf.toString(); }
PdfTokenizer tokeniser = ps.getTokeniser(); int shouldBeWhiteSpace = tokeniser.read(); // skip next character (which better be a whitespace character - I suppose we could check for this) int ch = tokeniser.read(); if (ch == -1) throw new InlineImageParseException(PdfException.EndOfContentStreamReachedBeforeEndOfImageData);
int found = 0; PdfTokenizer tokeniser = ps.getTokeniser(); while ((ch = tokeniser.read()) != -1) { if (ch == 'E') { baos.write(EI, 0, found); // probably some bytes were preserved so write them
while (isWhitespace((c = read()), isNullWhitespace)) ; eol = true; long cur = getPosition(); if ((read()) != '\n') { seek(cur); eol = true; } else { c = read(); eol = false; while (!eol) { switch (c = read()) { case -1: case '\n': eol = true; long cur = getPosition(); if ((read()) != '\n') { seek(cur);
while (isWhitespace((c = read()), isNullWhitespace)) ; eol = true; long cur = getPosition(); if ((read()) != '\n') { seek(cur); eol = true; } else { c = read(); eol = false; while (!eol) { switch (c = read()) { case -1: case '\n': eol = true; long cur = getPosition(); if ((read()) != '\n') { seek(cur);
/** * Parses the next inline image dictionary from the parser. The parser must be positioned immediately following the BI operator. * The parser will be left with position immediately following the whitespace character that follows the ID operator that ends the inline image dictionary. * * @param ps the parser to extract the embedded image information from * @return the dictionary for the inline image, with any abbreviations converted to regular image dictionary keys and values * @throws IOException if the parse fails */ private static PdfDictionary parseDictionary(PdfCanvasParser ps) throws IOException { // by the time we get to here, we have already parsed the BI operator PdfDictionary dict = new PdfDictionary(); for (PdfObject key = ps.readObject(); key != null && !"ID".equals(key.toString()); key = ps.readObject()) { PdfObject value = ps.readObject(); PdfName resolvedKey = inlineImageEntryAbbreviationMap.get((PdfName) key); if (resolvedKey == null) { resolvedKey = (PdfName) key; } dict.put(resolvedKey, getAlternateValue(resolvedKey, value)); } int ch = ps.getTokeniser().read(); if (!PdfTokenizer.isWhitespace(ch)) throw new InlineImageParseException(PdfException.UnexpectedCharacter1FoundAfterIDInInlineImage).setMessageParams(ch); return dict; }
int whiteSpacesCount = -1; do { ch = tokens.read(); whiteSpacesCount++; } while (ch != -1 && PdfTokenizer.isWhitespace(ch));
int whiteSpacesCount = -1; do { ch = tokens.read(); whiteSpacesCount++; } while (ch != -1 && PdfTokenizer.isWhitespace(ch));