public final void openPdfFile(final byte[] data) throws PdfException {
  final RandomAccessBuffer pdf_datafile;
  try {
    if (PdfFileReader.alwaysCacheInMemory == -1 || data.length < PdfFileReader.alwaysCacheInMemory) {
      pdf_datafile=new RandomAccessDataBuffer(data);
    }
 else {
      try {
        final File file=File.createTempFile("page",".bin",new File(ObjectStore.temp_dir));
        tempFileName=file.getAbsolutePath();
        final java.io.FileOutputStream a=new java.io.FileOutputStream(file);
        a.write(data);
        a.flush();
        a.close();
        pdf_datafile=new RandomAccessFileBuffer(tempFileName,"r");
      }
 catch (      final Exception e) {
        throw new RuntimeException("Unable to create temporary file in " + ObjectStore.temp_dir + ' '+ e);
      }
    }
    objectReader.init(pdf_datafile);
  }
 catch (  final Exception e) {
    LogWriter.writeLog("Exception " + e + " accessing file");
    throw new PdfException("Exception " + e + " accessing file");
  }
}

public final void openPdfFile ( final byte [ ] data ) throws PdfException { final RandomAccessBuffer pdf_datafile ; try { if ( PdfFileReader . alwaysCacheInMemory == - 1 || data . length < PdfFileReader . alwaysCacheInMemory ) { pdf_datafile = new RandomAccessDataBuffer ( data ) ; } else { try { final File file = File . createTempFile ( "page" , ".bin" , new File ( ObjectStore . temp_dir ) ) ; tempFileName = file . getAbsolutePath ( ) ; final java . io . FileOutputStream a = new java . io . FileOutputStream ( file ) ; a . write ( data ) ; a . flush ( ) ; a . close ( ) ; pdf_datafile = new RandomAccessFileBuffer ( tempFileName , "r" ) ; } catch ( final Exception e ) { throw new RuntimeException ( "Unable to create temporary file in " + ObjectStore . temp_dir + ' ' + e ) ; } } objectReader . init ( pdf_datafile ) ; } catch ( final Exception e ) { LogWriter . writeLog ( "Exception " + e + " accessing file" ) ; throw new PdfException ( "Exception " + e + " accessing file" ) ; } }
open pdf file using a byte stream - by default files under 16384 bytes are cached to disk but this can be altered by setting pdffilereader . alwayscacheinmemory to a maximimum size or - 1 ( always keep in memory )
