public byte[] getByteContent() { return outBuf.toByteArray(); }
public byte[] toByteArray() { return toByteArray(0, count); }
public byte[] toByteArray() { return toByteArray(0, count); }
public byte[] getByteContent() { return outBuf.toByteArray(); }
/** * Closes the encoder and returns the encoded data. * @return the encoded data */ public byte[] close() { Fax4PostEncode(); return outBuf.toByteArray(); }
/** * Escapes a {@code byte} array according to the PDF conventions. * * @param bytes the {@code byte} array to escape * @return an escaped {@code byte} array */ public static byte[] createEscapedString(byte[] bytes) { return createBufferedEscapedString(bytes).toByteArray(); }
/** * Escapes a {@code byte} array according to the PDF conventions. * * @param bytes the {@code byte} array to escape * @return an escaped {@code byte} array */ public static byte[] createEscapedString(byte[] bytes) { return createBufferedEscapedString(bytes).toByteArray(); }
/** * Closes the encoder and returns the encoded data. * @return the encoded data */ public byte[] close() { Fax4PostEncode(); return outBuf.toByteArray(); }
/** * 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(); } }
/** * 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); } }
public SerializedObjectContent serializeObject(PdfObject obj) { if (!obj.isStream() && !obj.isDictionary()) { return null; } PdfIndirectReference indRef = obj.getIndirectReference(); assert indRef != null; Map<PdfIndirectReference, byte[]> serializedCache = indRef.getDocument().serializedObjectsCache; byte[] content = serializedCache.get(indRef); if (content == null) { ByteBuffer bb = new ByteBuffer(); int level = 100; try { serObject(obj, bb, level, serializedCache); } catch (SelfReferenceException e) { return null; } content = bb.toByteArray(); } return new SerializedObjectContent(content); }
serializedCache.put(reference, bb.toByteArray()); savedBb.append(bb.getInternalBuffer());
return buffer.toByteArray();
return buffer.toByteArray();
return buffer.toByteArray();
content = buf.toByteArray();
/** * 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()); }
bb.append((byte) 48); byte[] bbArr = bb.toByteArray(); outs.write(bbArr); StreamUtil.copyBytes(readerSource, gaps[2] - 1, gaps[3] + 1, outs);
bb.append((byte) 48); byte[] bbArr = bb.toByteArray(); outs.write(bbArr); StreamUtil.copyBytes(readerSource, gaps[2] - 1, gaps[3] + 1, outs);