public static void inflate(byte[] deflated, byte[] inflated) { Inflater inflater = new Inflater(); inflater.setInput(deflated); try { inflater.inflate(inflated); } catch(DataFormatException dfe) { throw new ExceptionConverter(dfe); } }
public static byte[] createDocumentId() { MessageDigest md5; try { md5 = MessageDigest.getInstance("MD5"); } catch (Exception e) { throw new ExceptionConverter(e); } long time = System.currentTimeMillis(); long mem = Runtime.getRuntime().freeMemory(); String s = time + "+" + mem + "+" + (seq++); return md5.digest(s.getBytes()); }
char getCard16() { try { return buf.readChar(); } catch (Exception e) { throw new ExceptionConverter(e); } }
void seek(int offset) { try { buf.seek(offset); } catch (Exception e) { throw new ExceptionConverter(e); } }
int getPosition() { try { return (int)buf.getFilePointer(); } catch (Exception e) { throw new ExceptionConverter(e); } } int nextIndexOffset;
public static ICC_Profile getInstance(byte[] data) { try { Integer cs; cs = cstags.get(new String(data, 16, 4, "US-ASCII")); int numComponents = cs == null ? 0 : cs.intValue(); return getInstance(data, numComponents); } catch (UnsupportedEncodingException e) { throw new ExceptionConverter(e); } }
char getCard8() { try { byte i = buf.readByte(); return (char)(i & 0xff); } catch (Exception e) { throw new ExceptionConverter(e); } }
int getInt() { try { return buf.readInt(); } catch (Exception e) { throw new ExceptionConverter(e); } }
/** Gets the page label dictionary to insert into the document. * @return the page label dictionary */ public PdfDictionary getDictionary(PdfWriter writer) { try { return PdfNumberTree.writeTree(map, writer); } catch (IOException e) { throw new ExceptionConverter(e); } }
int getInt() { try { return buf.readInt(); } catch (Exception e) { throw new ExceptionConverter(e); } }
/** * Flushes the <CODE>BufferedOutputStream</CODE>. */ public void flush() { try { os.flush(); } catch(IOException ioe) { throw new ExceptionConverter(ioe); } }
public PdfEncryption() { try { md5 = MessageDigest.getInstance("MD5"); } catch (Exception e) { throw new ExceptionConverter(e); } publicKeyHandler = new PdfPublicKeySecurityHandler(); }
/** * Closes the reader, and any underlying stream or data source used to create the reader */ public void close() { try { tokens.close(); } catch (IOException e) { throw new ExceptionConverter(e); } }
char getCard16() { try { return buf.readChar(); } catch (Exception e) { throw new ExceptionConverter(e); } }
protected PdfIndirectReference add(final PdfICCBased icc) { PdfIndirectObject object; try { object = addToBody(icc); } catch(IOException ioe) { throw new ExceptionConverter(ioe); } return object.getIndirectReference(); }
PdfIndirectReference getReference() { try { if (reference == null) { reference = writer.addToBody(dictionary).getIndirectReference(); } } catch (IOException ioe) { throw new ExceptionConverter(ioe); } return reference; }
public byte[] encryptByteArray(byte[] b) { try { ByteArrayOutputStream ba = new ByteArrayOutputStream(); OutputStreamEncryption os2 = getEncryptionStream(ba); os2.write(b); os2.finish(); return ba.toByteArray(); } catch (IOException ex) { throw new ExceptionConverter(ex); } }
PdfIndirectReference getReference() { try { if (reference == null) { reference = writer.addToBody(dictionary).getIndirectReference(); } } catch (IOException ioe) { throw new ExceptionConverter(ioe); } return reference; }
void addJavaScript(final String name, final PdfAction js) { if (js.get(PdfName.JS) == null) throw new RuntimeException(MessageLocalization.getComposedMessage("only.javascript.actions.are.allowed")); try { documentLevelJS.put(name, writer.addToBody(js).getIndirectReference()); } catch (IOException e) { throw new ExceptionConverter(e); } }
/** * Adds the producer to a Document. * * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise */ public boolean addProducer() { try { return add(new Meta(Element.PRODUCER, Version.getInstance().getVersion())); } catch (DocumentException de) { throw new ExceptionConverter(de); } }