org.apache.sanselan.common.ZLibUtils.deflate()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(86)

本文整理了Java中org.apache.sanselan.common.ZLibUtils.deflate()方法的一些代码示例,展示了ZLibUtils.deflate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZLibUtils.deflate()方法的具体详情如下:
包路径:org.apache.sanselan.common.ZLibUtils
类名称:ZLibUtils
方法名:deflate

ZLibUtils.deflate介绍

暂无

代码示例

代码示例来源:origin: org.apache.sanselan/sanselan

private void writeChunkXmpiTXt(OutputStream os, String xmpXml)
    throws IOException
{
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  // keyword
  baos.write(XMP_KEYWORD.getBytes("ISO-8859-1"));
  baos.write(0);
  baos.write(1); // compressed flag, true
  baos.write(COMPRESSION_DEFLATE_INFLATE); // compression method
  baos.write(0); // language tag (ignore). TODO
  // translated keyword
  baos.write(XMP_KEYWORD.getBytes("utf-8"));
  baos.write(0);
  baos.write(new ZLibUtils().deflate(xmpXml.getBytes("utf-8")));
  writeChunk(os, iTXt_CHUNK_TYPE, baos.toByteArray());
}

代码示例来源:origin: fr.opensagres.xdocreport.appengine-awt/appengine-awt

private void writeChunkXmpiTXt(OutputStream os, String xmpXml)
    throws IOException
{
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  // keyword
  baos.write(XMP_KEYWORD.getBytes("ISO-8859-1"));
  baos.write(0);
  baos.write(1); // compressed flag, true
  baos.write(COMPRESSION_DEFLATE_INFLATE); // compression method
  baos.write(0); // language tag (ignore). TODO
  // translated keyword
  baos.write(XMP_KEYWORD.getBytes("utf-8"));
  baos.write(0);
  baos.write(new ZLibUtils().deflate(xmpXml.getBytes("utf-8")));
  writeChunk(os, iTXt_CHUNK_TYPE, baos.toByteArray());
}

代码示例来源:origin: org.apache.sanselan/sanselan

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());
}

代码示例来源:origin: fr.opensagres.xdocreport.appengine-awt/appengine-awt

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());
}

代码示例来源:origin: fr.opensagres.xdocreport.appengine-awt/appengine-awt

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());
}

代码示例来源:origin: org.apache.sanselan/sanselan

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());
}

相关文章