public final int findEndWithTerminator(byte bytes[], int index) throws UnicodeException { return findEnd(bytes, index, true); }
private void writeChunktEXt(OutputStream os, PngText.tEXt text) throws IOException, ImageWriteException { if (!UnicodeUtils.isValidISO_8859_1(text.keyword)) throw new ImageWriteException( "Png tEXt chunk keyword is not ISO-8859-1: " + text.keyword); if (!UnicodeUtils.isValidISO_8859_1(text.text)) throw new ImageWriteException( "Png tEXt chunk text is not ISO-8859-1: " + text.text); ByteArrayOutputStream baos = new ByteArrayOutputStream(); // keyword baos.write(text.keyword.getBytes("ISO-8859-1")); baos.write(0); // text baos.write(text.text.getBytes("ISO-8859-1")); writeChunk(os, tEXt_CHUNK_TYPE, baos.toByteArray()); }
private void writeChunktEXt(OutputStream os, PngText.tEXt text) throws IOException, ImageWriteException { if (!UnicodeUtils.isValidISO_8859_1(text.keyword)) throw new ImageWriteException( "Png tEXt chunk keyword is not ISO-8859-1: " + text.keyword); if (!UnicodeUtils.isValidISO_8859_1(text.text)) throw new ImageWriteException( "Png tEXt chunk text is not ISO-8859-1: " + text.text); ByteArrayOutputStream baos = new ByteArrayOutputStream(); // keyword baos.write(text.keyword.getBytes("ISO-8859-1")); baos.write(0); // text baos.write(text.text.getBytes("ISO-8859-1")); writeChunk(os, tEXt_CHUNK_TYPE, baos.toByteArray()); }
private void writeChunkiTXt(OutputStream os, PngText.iTXt text) throws IOException, ImageWriteException { if (!UnicodeUtils.isValidISO_8859_1(text.keyword)) throw new ImageWriteException( "Png tEXt chunk keyword is not ISO-8859-1: " + text.keyword); if (!UnicodeUtils.isValidISO_8859_1(text.languageTag)) throw new ImageWriteException( "Png tEXt chunk language tag is not ISO-8859-1: " + text.languageTag); ByteArrayOutputStream baos = new ByteArrayOutputStream(); // keyword baos.write(text.keyword.getBytes("ISO-8859-1")); baos.write(0); baos.write(1); // compressed flag, true baos.write(COMPRESSION_DEFLATE_INFLATE); // compression method // language tag baos.write(text.languageTag.getBytes("ISO-8859-1")); baos.write(0); // translated keyword baos.write(text.translatedKeyword.getBytes("utf-8")); baos.write(0); baos.write(new ZLibUtils().deflate(text.text.getBytes("utf-8"))); writeChunk(os, iTXt_CHUNK_TYPE, baos.toByteArray()); }
public final int findEndWithTerminator(byte bytes[], int index) throws UnicodeException { return findEnd(bytes, index, true); }
private void writeChunkzTXt(OutputStream os, PngText.zTXt text) throws IOException, ImageWriteException { if (!UnicodeUtils.isValidISO_8859_1(text.keyword)) throw new ImageWriteException( "Png zTXt chunk keyword is not ISO-8859-1: " + text.keyword); if (!UnicodeUtils.isValidISO_8859_1(text.text)) throw new ImageWriteException( "Png zTXt chunk text is not ISO-8859-1: " + text.text); ByteArrayOutputStream baos = new ByteArrayOutputStream(); // keyword baos.write(text.keyword.getBytes("ISO-8859-1")); baos.write(0); // compression method baos.write(PngConstants.COMPRESSION_DEFLATE_INFLATE); // text baos .write(new ZLibUtils().deflate(text.text .getBytes("ISO-8859-1"))); writeChunk(os, zTXt_CHUNK_TYPE, baos.toByteArray()); }
public final int findEndWithoutTerminator(byte bytes[], int index) throws UnicodeException { return findEnd(bytes, index, false); }
private void writeChunkiTXt(OutputStream os, PngText.iTXt text) throws IOException, ImageWriteException { if (!UnicodeUtils.isValidISO_8859_1(text.keyword)) throw new ImageWriteException( "Png tEXt chunk keyword is not ISO-8859-1: " + text.keyword); if (!UnicodeUtils.isValidISO_8859_1(text.languageTag)) throw new ImageWriteException( "Png tEXt chunk language tag is not ISO-8859-1: " + text.languageTag); ByteArrayOutputStream baos = new ByteArrayOutputStream(); // keyword baos.write(text.keyword.getBytes("ISO-8859-1")); baos.write(0); baos.write(1); // compressed flag, true baos.write(COMPRESSION_DEFLATE_INFLATE); // compression method // language tag baos.write(text.languageTag.getBytes("ISO-8859-1")); baos.write(0); // translated keyword baos.write(text.translatedKeyword.getBytes("utf-8")); baos.write(0); baos.write(new ZLibUtils().deflate(text.text.getBytes("utf-8"))); writeChunk(os, iTXt_CHUNK_TYPE, baos.toByteArray()); }
public final int findEndWithoutTerminator(byte bytes[], int index) throws UnicodeException { return findEnd(bytes, index, false); }
private void writeChunkzTXt(OutputStream os, PngText.zTXt text) throws IOException, ImageWriteException { if (!UnicodeUtils.isValidISO_8859_1(text.keyword)) throw new ImageWriteException( "Png zTXt chunk keyword is not ISO-8859-1: " + text.keyword); if (!UnicodeUtils.isValidISO_8859_1(text.text)) throw new ImageWriteException( "Png zTXt chunk text is not ISO-8859-1: " + text.text); ByteArrayOutputStream baos = new ByteArrayOutputStream(); // keyword baos.write(text.keyword.getBytes("ISO-8859-1")); baos.write(0); // compression method baos.write(PngConstants.COMPRESSION_DEFLATE_INFLATE); // text baos .write(new ZLibUtils().deflate(text.text .getBytes("ISO-8859-1"))); writeChunk(os, zTXt_CHUNK_TYPE, baos.toByteArray()); }