public void seek(long pos) throws IOException { seek((int)pos); }
public void seek(long pos) throws IOException { seek((int)pos); }
public void seek(int pos) throws IOException { file.seek(pos); }
public void seek(int pos) throws IOException { file.seek(pos); }
public void seek(int pos) throws IOException { file.seek(pos); }
public void seek(long pos) throws IOException { seek((int)pos); }
public void reOpen() throws IOException { if (filename != null && rf == null && trf == null) { if (plainRandomAccess) trf = new RandomAccessFile(filename, "r"); else rf = new MappedRandomAccessFile(filename, "r"); } seek(0); }
public void reOpen() throws IOException { if (filename != null && rf == null && trf == null) { if (plainRandomAccess) trf = new RandomAccessFile(filename, "r"); else rf = new MappedRandomAccessFile(filename, "r"); } seek(0); }
void seek(int offset) { try { buf.seek(offset); } catch (Exception e) { throw new ExceptionConverter(e); } }
void seek(int offset) { try { buf.seek(offset); } catch (Exception e) { throw new ExceptionConverter(e); } }
void seek(int offset) { try { buf.seek(offset); } catch (Exception e) { throw new ExceptionConverter(e); } }
public void reOpen() throws IOException { if (filename != null && rf == null && trf == null) { if (plainRandomAccess) trf = new RandomAccessFile(filename, "r"); else rf = new MappedRandomAccessFile(filename, "r"); } seek(0); }
public int getStartxref() throws IOException { int size = Math.min(1024, file.length()); int pos = file.length() - size; file.seek(pos); String str = readString(1024); int idx = str.lastIndexOf("startxref"); if (idx < 0) throw new IOException("PDF startxref not found."); return pos + idx; }
public void emit(byte[] buffer) { //System.err.println("range emit offset "+offset+" size="+length); try { buf.seek(offset); for (int i=myOffset; i<myOffset+length; i++) buffer[i] = buf.readByte(); } catch (Exception e) { throw new ExceptionConverter(e); } //System.err.println("finished range emit"); } }
public void emit(byte[] buffer) { //System.err.println("range emit offset "+offset+" size="+length); try { buf.seek(offset); for (int i=myOffset; i<myOffset+length; i++) buffer[i] = buf.readByte(); } catch (Exception e) { throw new ExceptionConverter(e); } //System.err.println("finished range emit"); } }
public void emit(byte[] buffer) { //System.err.println("range emit offset "+offset+" size="+length); try { buf.seek(offset); for (int i=myOffset; i<myOffset+length; i++) buffer[i] = buf.readByte(); } catch (Exception e) { throw new ExceptionConverter(e); } //System.err.println("finished range emit"); } }
public int getStartxref() throws IOException { int size = Math.min(1024, file.length()); int pos = file.length() - size; file.seek(pos); String str = readString(1024); int idx = str.lastIndexOf("startxref"); if (idx < 0) throw new InvalidPdfException(MessageLocalization.getComposedMessage("pdf.startxref.not.found")); return pos + idx; }
public int getStartxref() throws IOException { int size = Math.min(1024, file.length()); int pos = file.length() - size; file.seek(pos); String str = readString(1024); int idx = str.lastIndexOf("startxref"); if (idx < 0) throw new InvalidPdfException(MessageLocalization.getComposedMessage("pdf.startxref.not.found")); return pos + idx; }
/** Reads the glyphs widths. The widths are extracted from the table 'hmtx'. * The glyphs are normalized to 1000 units. * @throws DocumentException the font is invalid * @throws IOException the font file could not be read */ protected void readGlyphWidths() throws DocumentException, IOException { int[] table_location; table_location = (int[])tables.get("hmtx"); if (table_location == null) throw new DocumentException(MessageLocalization.getComposedMessage("table.1.does.not.exist.in.2", "hmtx", fileName + style)); rf.seek(table_location[0]); GlyphWidths = new int[hhea.numberOfHMetrics]; for (int k = 0; k < hhea.numberOfHMetrics; ++k) { GlyphWidths[k] = (rf.readUnsignedShort() * 1000) / head.unitsPerEm; rf.readUnsignedShort(); } }
protected void createTableDirectory() throws IOException, DocumentException { tableDirectory = new HashMap(); rf.seek(directoryOffset); int id = rf.readInt(); if (id != 0x00010000) throw new DocumentException(MessageLocalization.getComposedMessage("1.is.not.a.true.type.file", fileName)); int num_tables = rf.readUnsignedShort(); rf.skipBytes(6); for (int k = 0; k < num_tables; ++k) { String tag = readStandardString(4); int[] tableLocation = new int[3]; tableLocation[TABLE_CHECKSUM] = rf.readInt(); tableLocation[TABLE_OFFSET] = rf.readInt(); tableLocation[TABLE_LENGTH] = rf.readInt(); tableDirectory.put(tag, tableLocation); } }