/** * read a name (sequence of non-PDF-delimiting characters) from the * stream. */ private String readName() { int start = loc; while (loc < stream.length && PDFFile.isRegularCharacter(stream[loc])) { loc++; } return new String(stream, start, loc - start); }
/** * read a name (sequence of non-PDF-delimiting characters) from the * stream. */ private String readName() { int start = loc; while (loc < stream.length && PDFFile.isRegularCharacter(stream[loc])) { loc++; } return new String(stream, start, loc - start); }
/** * read a name (sequence of non-PDF-delimiting characters) from the * stream. */ private String readName() { int start = loc; while (loc < stream.length && PDFFile.isRegularCharacter(stream[loc])) { loc++; } return new String(stream, start, loc - start); }
/** * read a bare keyword. The initial character is passed in as the * argument. */ private PDFObject readKeyword(ByteBuffer buf, char start) throws IOException { // we've read the first character (it's passed in as the argument) StringBuffer sb = new StringBuffer(String.valueOf(start)); int c; while (isRegularCharacter(c = buf.get())) { sb.append((char) c); } buf.position(buf.position() - 1); return new PDFObject(this, PDFObject.KEYWORD, sb.toString()); }
/** * read a bare keyword. The initial character is passed in as the * argument. */ private PDFObject readKeyword(char start) throws IOException { // we've read the first character (it's passed in as the argument) StringBuffer sb = new StringBuffer(String.valueOf(start)); int c; while (isRegularCharacter(c = buf.get())) { sb.append((char) c); } buf.position(buf.position() - 1); return new PDFObject(this, PDFObject.KEYWORD, sb.toString()); }
/** * read a bare keyword. The initial character is passed in as the * argument. */ private PDFObject readKeyword(char start) throws IOException { // we've read the first character (it's passed in as the argument) StringBuffer sb = new StringBuffer(String.valueOf(start)); int c; while (isRegularCharacter(c = buf.get())) { sb.append((char) c); } buf.position(buf.position() - 1); return new PDFObject(this, PDFObject.KEYWORD, sb.toString()); }
/** * read a /name. The / has already been read. */ private PDFObject readName() throws IOException { // we've already read the / that begins the name. // all we have to check for is #hh hex notations. StringBuffer sb = new StringBuffer(); int c; while (isRegularCharacter(c = buf.get())) { if (c < '!' && c > '~') { break; // out-of-range, should have been hex } // H.3.2.4 indicates version 1.1 did not do hex escapes if (c == '#' && (majorVersion != 1 && minorVersion != 1)) { int hex = readHexPair(); if (hex >= 0) { c = hex; } else { throw new PDFParseException("Bad #hex in /Name"); } } sb.append((char) c); } buf.position(buf.position() - 1); return new PDFObject(this, PDFObject.NAME, sb.toString()); }
/** * get the next postscript "word". This is basically the next * non-whitespace block between two whitespace delimiters. * This means that something like " [2 4 53]" will produce * three items, while " [2 4 56 ]" will produce four. */ public String readThing() { // skip whitespace // System.out.println("PAParser: whitespace: \""); while (PDFFile.isWhiteSpace(data[loc])) { // System.out.print (new String(data, loc, 1)); loc++; } // System.out.print("\": thing: "); // read thing int start = loc; while (!PDFFile.isWhiteSpace(data[loc])) { loc++; if (!PDFFile.isRegularCharacter(data[loc])) { break; // leave with the delimiter included } } String s = new String(data, start, loc - start); // System.out.println(": Read: "+s); return s; }
/** * read a /name. The / has already been read. */ private PDFObject readName() throws IOException { // we've already read the / that begins the name. // all we have to check for is #hh hex notations. StringBuffer sb = new StringBuffer(); int c; while (isRegularCharacter(c = buf.get())) { if (c < '!' && c > '~') { break; // out-of-range, should have been hex } // H.3.2.4 indicates version 1.1 did not do hex escapes if (c == '#' && (majorVersion != 1 && minorVersion != 1)) { int hex = readHexPair(); if (hex >= 0) { c = hex; } else { throw new PDFParseException("Bad #hex in /Name"); } } sb.append((char) c); } buf.position(buf.position() - 1); return new PDFObject(this, PDFObject.NAME, sb.toString()); }
/** * read a /name. The / has already been read. * @param buf the buffer to read from */ private PDFObject readName(ByteBuffer buf) throws IOException { // we've already read the / that begins the name. // all we have to check for is #hh hex notations. StringBuffer sb = new StringBuffer(); int c; while (isRegularCharacter(c = buf.get())) { if (c < '!' && c > '~') { break; // out-of-range, should have been hex } // H.3.2.4 indicates version 1.1 did not do hex escapes if (c == '#' && (majorVersion != 1 && minorVersion != 1)) { int hex = readHexPair(buf); if (hex >= 0) { c = hex; } else { throw new PDFParseException("Bad #hex in /Name"); } } sb.append((char) c); } buf.position(buf.position() - 1); return new PDFObject(this, PDFObject.NAME, sb.toString()); }
/** * get the next postscript "word". This is basically the next * non-whitespace block between two whitespace delimiters. * This means that something like " [2 4 53]" will produce * three items, while " [2 4 56 ]" will produce four. */ public String readThing() { // skip whitespace // System.out.println("PAParser: whitespace: \""); while (PDFFile.isWhiteSpace(data[loc])) { // System.out.print (new String(data, loc, 1)); loc++; } // System.out.print("\": thing: "); // read thing int start = loc; while (!PDFFile.isWhiteSpace(data[loc])) { loc++; if (!PDFFile.isRegularCharacter(data[loc])) { break; // leave with the delimiter included } } String s = new String(data, start, loc - start); // System.out.println(": Read: "+s); return s; }
/** * get the next postscript "word". This is basically the next * non-whitespace block between two whitespace delimiters. * This means that something like " [2 4 53]" will produce * three items, while " [2 4 56 ]" will produce four. */ public String readThing() { // skip whitespace // System.out.println("PAParser: whitespace: \""); while (PDFFile.isWhiteSpace(data[loc])) { // System.out.print (new String(data, loc, 1)); loc++; } // System.out.print("\": thing: "); // read thing int start = loc; while (!PDFFile.isWhiteSpace(data[loc])) { loc++; if (!PDFFile.isRegularCharacter(data[loc])) { break; // leave with the delimiter included } } String s = new String(data, start, loc - start); // System.out.println(": Read: "+s); return s; }