/** * Is a certain character a whitespace? Currently checks on the following: '0', '9', '10', '12', '13', '32'. * <br> * The same as calling {@link #isWhitespace(int, boolean) isWhiteSpace(ch, true)}. * * @param ch int * @return boolean */ public static boolean isWhitespace(int ch) { return isWhitespace(ch, true); }
/** * Is a certain character a whitespace? Currently checks on the following: '0', '9', '10', '12', '13', '32'. * <br> * The same as calling {@link #isWhitespace(int, boolean) isWhiteSpace(ch, true)}. * * @param ch int * @return boolean */ public static boolean isWhitespace(int ch) { return isWhitespace(ch, true); }
/** * Decodes a byte[] according to ASCII Hex encoding. * * @param in byte[] to be decoded * @return decoded byte[] */ public static byte[] ASCIIHexDecode(byte[] in) { ByteArrayOutputStream out = new ByteArrayOutputStream(); boolean first = true; int n1 = 0; for (int k = 0; k < in.length; ++k) { int ch = in[k] & 0xff; if (ch == '>') break; if (PdfTokenizer.isWhitespace(ch)) continue; int n = ByteBuffer.getHex(ch); if (n == -1) throw new PdfException(PdfException.IllegalCharacterInAsciihexdecode); if (first) n1 = n; else out.write((byte)((n1 << 4) + n)); first = !first; } if (!first) out.write((byte)(n1 << 4)); return out.toByteArray(); } }
if (ch == '~') break; if (PdfTokenizer.isWhitespace(ch)) continue; if (ch == 'z' && state == 0) {
found = 2; // just preserve 'EI' and do not write it immediately } else { if (found == 2 && PdfTokenizer.isWhitespace(ch)) { byte[] tmp = baos.toByteArray(); if (inlineImageStreamBytesAreComplete(tmp, imageDictionary)) {
/** * 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; }
if (!PdfTokenizer.isWhitespace(shouldBeWhiteSpace) || shouldBeWhiteSpace == 0) { // tokeniser treats 0 as whitespace, but for our purposes, we shouldn't bytes[0] = (byte) shouldBeWhiteSpace; startIndex++;
do { ch = file.read(); } while (ch != -1 && isWhitespace(ch)); if (ch == -1) { type = TokenType.EndOfFile; int v2 = 0; while (true) { while (isWhitespace(v1)) v1 = file.read(); if (v1 == '>') break; v2 = file.read(); while (isWhitespace(v2)) v2 = file.read(); if (v2 == '>') {
do { ch = file.read(); } while (ch != -1 && isWhitespace(ch)); if (ch == -1) { type = TokenType.EndOfFile; int v2 = 0; while (true) { while (isWhitespace(v1)) v1 = file.read(); if (v1 == '>') break; v2 = file.read(); while (isWhitespace(v2)) v2 = file.read(); if (v2 == '>') {
while (isWhitespace((c = read()), isNullWhitespace)) ;
while (isWhitespace((c = read()), isNullWhitespace)) ;
ch = tokens.read(); whiteSpacesCount++; } while (ch != -1 && PdfTokenizer.isWhitespace(ch)); tokens.seek(startPosition); obj = readObject(true, objStm);
ch = tokens.read(); whiteSpacesCount++; } while (ch != -1 && PdfTokenizer.isWhitespace(ch)); tokens.seek(startPosition); obj = readObject(true, objStm);