/** * Converts an array of bytes to a String of hexadecimal values * @param bytes a byte array * @return the same bytes expressed as hexadecimal values */ public static String convertToHex(byte[] bytes) { ByteBuffer buf = new ByteBuffer(); for (byte b : bytes) { buf.appendHex(b); } return PdfEncodings.convertToString(buf.toByteArray(), null).toUpperCase(); }
/** * Converts an array of bytes to a String of hexadecimal values * @param bytes a byte array * @return the same bytes expressed as hexadecimal values */ public static String convertToHex(byte[] bytes) { ByteBuffer buf = new ByteBuffer(); for (byte b : bytes) { buf.appendHex(b); } return PdfEncodings.convertToString(buf.toByteArray(), null).toUpperCase(); }
public static PdfObject createInfoId(byte id[], boolean modified) throws IOException { ByteBuffer buf = new ByteBuffer(90); if (id.length == 0) id = createDocumentId(); buf.append('[').append('<'); for (int k = 0; k < id.length; ++k) buf.appendHex(id[k]); buf.append('>').append('<'); if (modified) id = createDocumentId(); for (int k = 0; k < id.length; ++k) buf.appendHex(id[k]); buf.append('>').append(']'); buf.close(); return new PdfLiteral(buf.toByteArray()); }
public static PdfObject createInfoId(byte id[], boolean modified) throws IOException { ByteBuffer buf = new ByteBuffer(90); if (id.length == 0) id = createDocumentId(); buf.append('[').append('<'); for (int k = 0; k < id.length; ++k) buf.appendHex(id[k]); buf.append('>').append('<'); if (modified) id = createDocumentId(); for (int k = 0; k < id.length; ++k) buf.appendHex(id[k]); buf.append('>').append(']'); buf.close(); return new PdfLiteral(buf.toByteArray()); }
/** * 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 { PdfWriter.checkPdfIsoConformance(writer, PdfIsoKeys.PDFISOKEY_OBJECT, this); 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(StringUtils.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 { PdfWriter.checkPdfIsoConformance(writer, PdfIsoKeys.PDFISOKEY_OBJECT, this); 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(StringUtils.escapeString(b)); }
ByteBuffer bb = new ByteBuffer(spaceAvailable * 2); for (byte bi : signedContent) { bb.appendHex(bi);
ByteBuffer bb = new ByteBuffer(spaceAvailable * 2); for (byte bi : signedContent) { bb.appendHex(bi);