/** returns current location pointer and sets to new value */ public void movePointer(final long pointer) { try { // make sure inside file if (pointer > pdf_datafile.length()) { if (LogWriter.isOutput()) { LogWriter.writeLog("Attempting to access ref outside file"); } // throw new PdfException("Exception moving file pointer - ref outside file"); } else { pdf_datafile.seek(pointer); } } catch (final Exception e) { if (LogWriter.isOutput()) { LogWriter.writeLog("Exception " + e + " moving pointer to " + pointer + " in file."); } } }
byte[] getBytes(final long start, final int count) { final byte[] buffer = new byte[count]; if (start >= 0) { try { pdf_datafile.seek(start); pdf_datafile.read(buffer); // get next chars } catch (final IOException e) { // tell user and log if (LogWriter.isOutput()) { LogWriter.writeLog("Exception: " + e.getMessage()); } // } } return buffer; }