public void close() throws IOException { if (!closed) { raf.close(); closed = true; } } }
public void close() throws IOException { if (!closed) { raf.close(); closed = true; } } }
public void close() throws IOException { if (!closed) { raf.close(); closed = true; } } }
public void close() throws IOException { file.close(); }
public void close() throws IOException { file.close(); }
public void close() throws IOException { file.close(); }
/** * @param reader */ public void unRegisterReader(PdfReader reader) { if (!readers2intrefs.containsKey(reader)) return; readers2intrefs.remove(reader); RandomAccessFileOrArray raf = (RandomAccessFileOrArray)readers2file.get(reader); if (raf == null) return; readers2file.remove(reader); try{raf.close();}catch(Exception e){} }
/** * @param reader */ public void unRegisterReader(PdfReader reader) { if (!readers2intrefs.containsKey(reader)) return; readers2intrefs.remove(reader); RandomAccessFileOrArray raf = (RandomAccessFileOrArray)readers2file.get(reader); if (raf == null) return; readers2file.remove(reader); try{raf.close();}catch(Exception e){} }
/** * @param reader */ public void unRegisterReader(PdfReader reader) { if (!this.readers2intrefs.containsKey(reader)) return; this.readers2intrefs.remove(reader); RandomAccessFileOrArray raf = (RandomAccessFileOrArray)this.readers2file.get(reader); if (raf == null) return; this.readers2file.remove(reader); try{raf.close();}catch(Exception e){} }
public static void main(String[] args) { try { RandomAccessFileOrArray in = new RandomAccessFileOrArray(args[0]); OutputStream out = new FileOutputStream(args[1]); convert(in, out); in.close(); out.close(); } catch (Exception e) { e.printStackTrace(); } }
public static void main(String[] args) { try { RandomAccessFileOrArray in = new RandomAccessFileOrArray(args[0]); OutputStream out = new FileOutputStream(args[1]); convert(in, out); in.close(); out.close(); } catch (Exception e) { e.printStackTrace(); } }
public static void main(String[] args) { try { RandomAccessFileOrArray in = new RandomAccessFileOrArray(args[0]); OutputStream out = new FileOutputStream(args[1]); convert(in, out); in.close(); out.close(); } catch (Exception e) { e.printStackTrace(); } }
/** * Gets the content stream of a page. * @param pageNum the page number of page you want get the content stream from * @return a byte array with the content stream of a page * @throws IOException */ private byte[] getContentBytesForPage(int pageNum) throws IOException { RandomAccessFileOrArray f = reader.getSafeFile(); byte[] contentBytes = reader.getPageContent(pageNum, f); f.close(); return contentBytes; }
public static void populateDescription(String path, byte[] contents, BaseFont font, FontDescription descr) throws IOException, NoSuchFieldException, IllegalAccessException, DocumentException { RandomAccessFileOrArray rf = null; try { rf = new RandomAccessFileOrArray(contents); rf = populateDescription0(path, font, descr, rf); } finally { if (rf != null) { try { rf.close(); } catch (IOException e) { // ignore } } } }
public void freeReader(PdfReader reader) throws IOException { indirectMap.remove(reader); if (currentPdfReaderInstance != null) { if (currentPdfReaderInstance.getReader() == reader) { try { currentPdfReaderInstance.getReader().close(); currentPdfReaderInstance.getReaderFile().close(); } catch (IOException ioe) { // empty on purpose } currentPdfReaderInstance = null; } } }
protected byte[] getFullFont() throws IOException { RandomAccessFileOrArray rf2 = null; try { rf2 = new RandomAccessFileOrArray(rf); rf2.reOpen(); byte b[] = new byte[rf2.length()]; rf2.readFully(b); return b; } finally { try {if (rf2 != null) {rf2.close();}} catch (Exception e) {} } }
protected byte[] getFullFont() throws IOException { RandomAccessFileOrArray rf2 = null; try { rf2 = new RandomAccessFileOrArray(rf); rf2.reOpen(); byte b[] = new byte[rf2.length()]; rf2.readFully(b); return b; } finally { try {if (rf2 != null) {rf2.close();}} catch (Exception e) {} } }
protected byte[] getFullFont() throws IOException { RandomAccessFileOrArray rf2 = null; try { rf2 = new RandomAccessFileOrArray(rf); rf2.reOpen(); byte[] b = new byte[rf2.length()]; rf2.readFully(b); return b; } finally { try {if (rf2 != null) {rf2.close();}} catch (Exception e) {} } }
/** Get the content from a stream as it is without applying any filter. * @param stream the stream * @throws IOException on error * @return the stream content */ public static byte[] getStreamBytesRaw(PRStream stream) throws IOException { RandomAccessFileOrArray rf = stream.getReader().getSafeFile(); try { rf.reOpen(); return getStreamBytesRaw(stream, rf); } finally { try{rf.close();}catch(Exception e){} } }
/** Get the content from a stream as it is without applying any filter. * @param stream the stream * @throws IOException on error * @return the stream content */ public static byte[] getStreamBytesRaw(PRStream stream) throws IOException { RandomAccessFileOrArray rf = stream.getReader().getSafeFile(); try { rf.reOpen(); return getStreamBytesRaw(stream, rf); } finally { try{rf.close();}catch(Exception e){} } }