public int getIntValue() { return Integer.parseInt(getStringValue()); }
public long getLongValue() { return Long.parseLong(getStringValue()); }
public int getIntValue() { return Integer.parseInt(getStringValue()); }
public long getLongValue() { return Long.parseLong(getStringValue()); }
protected PdfName readPdfName(boolean readAsDirect) { if (readAsDirect) { PdfName cachedName = PdfName.staticNames.get(tokens.getStringValue()); if (cachedName != null) return cachedName; } // an indirect name (how odd...), or a non-standard one return new PdfName(tokens.getByteContent()); }
continue; if (tk.getTokenType() == PdfTokenizer.TokenType.Other) { String operator = tk.getStringValue(); if (operator.equals("Tf")) { if (stack.size() >= 2) { stack.add(tk.getStringValue());
continue; if (tk.getTokenType() == PdfTokenizer.TokenType.Other) { String operator = tk.getStringValue(); if (operator.equals("Tf")) { if (stack.size() >= 2) { stack.add(tk.getStringValue());
/** * Reads a dictionary. The tokeniser must be positioned past the {@code "<<"} token. * @return the dictionary * @throws java.io.IOException on error */ public CMapObject readDictionary() throws java.io.IOException { Map<String, CMapObject> dic = new HashMap<>(); while (true) { if (!nextValidToken()) throw new IOException("Unexpected end of file."); if (tokeniser.getTokenType() == TokenType.EndDic) break; if (tokeniser.getTokenType() == TokenType.Other && "def".equals(tokeniser.getStringValue())) continue; if (tokeniser.getTokenType() != TokenType.Name) throw new IOException("Dictionary key {0} is not a name.").setMessageParams(tokeniser.getStringValue()); String name = tokeniser.getStringValue(); CMapObject obj = readObject(); if (obj.isToken()) { if (obj.toString().equals(">>")) { tokeniser.throwError(IOException.UnexpectedGtGt); } if (obj.toString().equals("]")) { tokeniser.throwError(IOException.UnexpectedCloseBracket); } } dic.put(name, obj); } return new CMapObject(CMapObject.DICTIONARY, dic); }
/** * Reads a dictionary. The tokeniser must be positioned past the {@code "<<"} token. * @return the dictionary * @throws java.io.IOException on error */ public CMapObject readDictionary() throws java.io.IOException { Map<String, CMapObject> dic = new HashMap<>(); while (true) { if (!nextValidToken()) throw new IOException("Unexpected end of file."); if (tokeniser.getTokenType() == TokenType.EndDic) break; if (tokeniser.getTokenType() == TokenType.Other && "def".equals(tokeniser.getStringValue())) continue; if (tokeniser.getTokenType() != TokenType.Name) throw new IOException("Dictionary key {0} is not a name.").setMessageParams(tokeniser.getStringValue()); String name = tokeniser.getStringValue(); CMapObject obj = readObject(); if (obj.isToken()) { if (obj.toString().equals(">>")) { tokeniser.throwError(IOException.UnexpectedGtGt); } if (obj.toString().equals("]")) { tokeniser.throwError(IOException.UnexpectedCloseBracket); } } dic.put(name, obj); } return new CMapObject(CMapObject.DICTIONARY, dic); }
/** * Reads a dictionary. The tokeniser must be positioned past the "<<" token. * @return the dictionary * @throws IOException on error */ public PdfDictionary readDictionary() throws IOException { PdfDictionary dic = new PdfDictionary(); while (true) { if (!nextValidToken()) throw new PdfException(PdfException.UnexpectedEndOfFile); if (tokeniser.getTokenType() == PdfTokenizer.TokenType.EndDic) break; if (tokeniser.getTokenType() != PdfTokenizer.TokenType.Name) tokeniser.throwError(PdfException.DictionaryKey1IsNotAName, tokeniser.getStringValue()); PdfName name = new PdfName(tokeniser.getStringValue()); PdfObject obj = readObject(); dic.put(name, obj); } return dic; }
CMapObject numObject = new CMapObject(CMapObject.NUMBER, null); try { numObject.setValue((int)java.lang.Double.parseDouble(tokeniser.getStringValue())); } catch (NumberFormatException e) { numObject.setValue(Integer.MIN_VALUE); return new CMapObject(CMapObject.LITERAL, tokeniser.getStringValue()); case EndArray: return new CMapObject(CMapObject.TOKEN, "]");
CMapObject numObject = new CMapObject(CMapObject.NUMBER, null); try { numObject.setValue((int)java.lang.Double.parseDouble(tokeniser.getStringValue())); } catch (NumberFormatException e) { numObject.setValue(Integer.MIN_VALUE); return new CMapObject(CMapObject.LITERAL, tokeniser.getStringValue()); case EndArray: return new CMapObject(CMapObject.TOKEN, "]");
protected PdfDictionary readDictionary(boolean objStm) throws IOException { PdfDictionary dic = new PdfDictionary(); while (true) { tokens.nextValidToken(); if (tokens.getTokenType() == PdfTokenizer.TokenType.EndDic) break; if (tokens.getTokenType() != PdfTokenizer.TokenType.Name) tokens.throwError(PdfException.DictionaryKey1IsNotAName, tokens.getStringValue()); PdfName name = readPdfName(true); PdfObject obj = readObject(true, objStm); if (obj == null) { if (tokens.getTokenType() == PdfTokenizer.TokenType.EndDic) tokens.throwError(PdfException.UnexpectedGtGt); if (tokens.getTokenType() == PdfTokenizer.TokenType.EndArray) tokens.throwError(PdfException.UnexpectedCloseBracket); } dic.put(name, obj); } return dic; }
tokens.throwError(PdfException.DictionaryKey1IsNotAName, tokens.getStringValue());
tokens.throwError(PdfException.DictionaryKey1IsNotAName, tokens.getStringValue());