/** * 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 ByteBuffer createBufferedHexedString(byte[] bytes) { ByteBuffer buf = new ByteBuffer(bytes.length * 2 + 2); buf.append('<'); for (byte b : bytes) { buf.appendHex(b); } buf.append('>'); return buf; }
public static ByteBuffer createBufferedHexedString(byte[] bytes) { ByteBuffer buf = new ByteBuffer(bytes.length * 2 + 2); buf.append('<'); for (byte b : bytes) { buf.appendHex(b); } buf.append('>'); return buf; }
/** * Escape special symbols or convert to hexadecimal string. * This method don't change either {@code value} or {@code content} ot the {@code PdfString}. * * @param bytes byte array to manipulate with. * @return Hexadecimal string or string with escaped symbols in byte array view. */ protected byte[] encodeBytes(byte[] bytes) { if (hexWriting) { ByteBuffer buf = new ByteBuffer(bytes.length * 2); for (byte b : bytes) { buf.appendHex(b); } return buf.getInternalBuffer(); } else { ByteBuffer buf = StreamUtil.createBufferedEscapedString(bytes); return buf.toByteArray(1, buf.size() - 2); } }
/** * Creates a PdfLiteral that contains an array of two id entries. These entries are both hexadecimal * strings containing 16 hex characters. The first entry is the original id, the second entry * should be different from the first one if the document has changed. * * @param firstId the first id * @param secondId the second id * @return PdfObject containing the two entries. */ public static PdfObject createInfoId(byte[] firstId, byte[] secondId) { if ( firstId.length < 16 ) { firstId = padByteArrayTo16(firstId); } if ( secondId.length < 16 ) { secondId = padByteArrayTo16(secondId); } com.itextpdf.io.source.ByteBuffer buf = new com.itextpdf.io.source.ByteBuffer(90); buf.append('[').append('<'); for (int k = 0; k < firstId.length; ++k) buf.appendHex(firstId[k]); buf.append('>').append('<'); for (int k = 0; k < secondId.length; ++k) buf.appendHex(secondId[k]); buf.append('>').append(']'); return new PdfLiteral(buf.toByteArray()); }
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);