/** * Escapes a <CODE>byte</CODE> array according to the PDF conventions. * * @param b the <CODE>byte</CODE> array to escape * @return an escaped <CODE>byte</CODE> array */ static byte[] escapeString(byte b[]) { ByteBuffer content = new ByteBuffer(); escapeString(b, content); return content.toByteArray(); }
/** * Escapes a <CODE>byte</CODE> array according to the PDF conventions. * * @param b the <CODE>byte</CODE> array to escape * @return an escaped <CODE>byte</CODE> array */ static byte[] escapeString(byte b[]) { ByteBuffer content = new ByteBuffer(); escapeString(b, content); return content.toByteArray(); }
/** * Escapes a <CODE>byte</CODE> array according to the PDF conventions. * * @param b the <CODE>byte</CODE> array to escape * @return an escaped <CODE>byte</CODE> array */ static byte[] escapeString(byte[] b) { ByteBuffer content = new ByteBuffer(); escapeString(b, content); return content.toByteArray(); }
ByteStore(PRStream str) throws IOException { try { md5 = MessageDigest.getInstance("MD5"); } catch (Exception e) { throw new ExceptionConverter(e); } ByteBuffer bb = new ByteBuffer(); int level = 100; serObject(str, level, bb); this.b = bb.toByteArray(); md5 = null; }
ByteStore(PRStream str) throws IOException { try { md5 = MessageDigest.getInstance("MD5"); } catch (Exception e) { throw new ExceptionConverter(e); } ByteBuffer bb = new ByteBuffer(); int level = 100; serObject(str, level, bb); this.b = bb.toByteArray(); md5 = null; }
ByteStore(PRStream str) throws IOException { try { md5 = MessageDigest.getInstance("MD5"); } catch (Exception e) { throw new ExceptionConverter(e); } ByteBuffer bb = new ByteBuffer(); int level = 100; serObject(str, level, bb); this.b = bb.toByteArray(); md5 = null; }
/** * @see Graphics#dispose() */ public void dispose() { if (kid) return; if (!disposeCalled) { disposeCalled = true; cb.restoreState(); cb.restoreState(); dg2.dispose(); dg2 = null; if (kids != null) { ByteBuffer buf = new ByteBuffer(); internalDispose(buf); ByteBuffer buf2 = cb.getInternalBuffer(); buf2.reset(); buf2.append(buf); } } }
/** * @see Graphics#dispose() */ public void dispose() { if (kid) return; if (!disposeCalled) { disposeCalled = true; cb.restoreState(); cb.restoreState(); dg2.dispose(); dg2 = null; if (kids != null) { ByteBuffer buf = new ByteBuffer(); internalDispose(buf); ByteBuffer buf2 = cb.getInternalBuffer(); buf2.reset(); buf2.append(buf); } } }
ByteBuffer buf = new ByteBuffer(length + 20); buf.append('/'); char c;
ByteBuffer buf = new ByteBuffer(length + 20); buf.append('/'); char c;
private PdfWriter.PdfBody.PdfCrossReference addToObjStm(PdfObject obj, int nObj) throws IOException { if (numObj >= OBJSINSTREAM) flushObjStm(); if (index == null) { index = new ByteBuffer(); streamObjects = new ByteBuffer(); currentObjNum = getIndirectReferenceNumber(); numObj = 0; } int p = streamObjects.size(); int idx = numObj++; PdfEncryption enc = writer.crypto; writer.crypto = null; obj.toPdf(writer, streamObjects); writer.crypto = enc; streamObjects.append(' '); index.append(nObj).append(' ').append(p).append(' '); return new PdfWriter.PdfBody.PdfCrossReference(2, nObj, currentObjNum, idx); }
private PdfWriter.PdfBody.PdfCrossReference addToObjStm(PdfObject obj, int nObj) throws IOException { if (numObj >= OBJSINSTREAM) flushObjStm(); if (index == null) { index = new ByteBuffer(); streamObjects = new ByteBuffer(); currentObjNum = getIndirectReferenceNumber(); numObj = 0; } int p = streamObjects.size(); int idx = numObj++; PdfEncryption enc = writer.crypto; writer.crypto = null; obj.toPdf(writer, streamObjects); writer.crypto = enc; streamObjects.append(' '); index.append(nObj).append(' ').append(p).append(' '); return new PdfWriter.PdfBody.PdfCrossReference(2, nObj, currentObjNum, idx); }
private PdfWriter.PdfBody.PdfCrossReference addToObjStm(PdfObject obj, int nObj) throws IOException { if (numObj >= OBJSINSTREAM) flushObjStm(); if (index == null) { index = new ByteBuffer(); streamObjects = new ByteBuffer(); currentObjNum = getIndirectReferenceNumber(); numObj = 0; } int p = streamObjects.size(); int idx = numObj++; PdfEncryption enc = writer.crypto; writer.crypto = null; obj.toPdf(writer, streamObjects); writer.crypto = enc; streamObjects.append(' '); index.append(nObj).append(' ').append(p).append(' '); return new PdfWriter.PdfBody.PdfCrossReference(2, nObj, currentObjNum, idx); }
/** * Writes the PDF representation of this <CODE>PdfString</CODE> as an array * of <CODE>byte</CODE> to the specified <CODE>OutputStream</CODE>. * * @param writer for backwards compatibility * @param os The <CODE>OutputStream</CODE> to write the bytes to. */ public void toPdf(PdfWriter writer, OutputStream os) throws IOException { byte[] b = getBytes(); PdfEncryption crypto = null; if (writer != null) crypto = writer.getEncryption(); if (crypto != null && !crypto.isEmbeddedFilesOnly()) b = crypto.encryptByteArray(b); if (hexWriting) { ByteBuffer buf = new ByteBuffer(); buf.append('<'); int len = b.length; for (int k = 0; k < len; ++k) buf.appendHex(b[k]); buf.append('>'); os.write(buf.toByteArray()); } else os.write(PdfContentByte.escapeString(b)); }
/** * Writes the PDF representation of this <CODE>PdfString</CODE> as an array * of <CODE>byte</CODE> to the specified <CODE>OutputStream</CODE>. * * @param writer for backwards compatibility * @param os The <CODE>OutputStream</CODE> to write the bytes to. */ public void toPdf(PdfWriter writer, OutputStream os) throws IOException { byte b[] = getBytes(); PdfEncryption crypto = null; if (writer != null) crypto = writer.getEncryption(); if (crypto != null && !crypto.isEmbeddedFilesOnly()) b = crypto.encryptByteArray(b); if (hexWriting) { ByteBuffer buf = new ByteBuffer(); buf.append('<'); int len = b.length; for (int k = 0; k < len; ++k) buf.appendHex(b[k]); buf.append('>'); os.write(buf.toByteArray()); } else os.write(PdfContentByte.escapeString(b)); }
/** * Writes the PDF representation of this <CODE>PdfString</CODE> as an array * of <CODE>byte</CODE> to the specified <CODE>OutputStream</CODE>. * * @param writer for backwards compatibility * @param os The <CODE>OutputStream</CODE> to write the bytes to. */ public void toPdf(PdfWriter writer, OutputStream os) throws IOException { byte b[] = getBytes(); PdfEncryption crypto = null; if (writer != null) crypto = writer.getEncryption(); if (crypto != null && !crypto.isEmbeddedFilesOnly()) b = crypto.encryptByteArray(b); if (hexWriting) { ByteBuffer buf = new ByteBuffer(); buf.append('<'); int len = b.length; for (int k = 0; k < len; ++k) buf.appendHex(b[k]); buf.append('>'); os.write(buf.toByteArray()); } else os.write(PdfContentByte.escapeString(b)); }
/** * @see Graphics#dispose() */ public void dispose() { if (kid) return; if (!disposeCalled) { disposeCalled = true; cb.restoreState(); cb.restoreState(); dg2.dispose(); dg2 = null; if (kids != null) { ByteBuffer buf = new ByteBuffer(); internalDispose(buf); ByteBuffer buf2 = cb.getInternalBuffer(); buf2.reset(); buf2.append(buf); } } }
public static PdfObject createInfoId(byte id[]) { ByteBuffer buf = new ByteBuffer(90); buf.append('[').append('<'); for (int k = 0; k < 16; ++k) buf.appendHex(id[k]); buf.append('>').append('<'); id = createDocumentId(); for (int k = 0; k < 16; ++k) buf.appendHex(id[k]); buf.append('>').append(']'); return new PdfLiteral(buf.toByteArray()); }
public static PdfObject createInfoId(byte[] id) { ByteBuffer buf = new ByteBuffer(90); buf.append('[').append('<'); for (int k = 0; k < 16; ++k) buf.appendHex(id[k]); buf.append('>').append('<'); id = createDocumentId(); for (int k = 0; k < 16; ++k) buf.appendHex(id[k]); buf.append('>').append(']'); return new PdfLiteral(buf.toByteArray()); }
public static PdfObject createInfoId(byte id[]) { ByteBuffer buf = new ByteBuffer(90); buf.append('[').append('<'); for (int k = 0; k < 16; ++k) buf.appendHex(id[k]); buf.append('>').append('<'); id = createDocumentId(); for (int k = 0; k < 16; ++k) buf.appendHex(id[k]); buf.append('>').append(']'); return new PdfLiteral(buf.toByteArray()); }