gpt4 book ai didi

org.apache.sanselan.common.ZLibUtils类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 09:42:49 27 4
gpt4 key购买 nike

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

ZLibUtils介绍

暂无

代码示例

代码示例来源: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

public final byte[] inflate(byte bytes[]) throws IOException
// slow, probably.
{
  ByteArrayInputStream in = new ByteArrayInputStream(bytes);
  InflaterInputStream zIn = new InflaterInputStream(in);
  return getStreamBytes(zIn);
}

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

public PNGChunkzTXt(int length, int chunkType, int crc, byte bytes[])
    throws ImageReadException, IOException
{
  super(length, chunkType, crc, bytes);
  {
    int index = findNull(bytes);
    if (index < 0)
      throw new ImageReadException(
          "PNG zTXt chunk keyword is unterminated.");
    keyword = new String(bytes, 0, index, "ISO-8859-1");
    index++;
    int compressionMethod = bytes[index++];
    if (compressionMethod != PngConstants.COMPRESSION_DEFLATE_INFLATE)
      throw new ImageReadException(
          "PNG zTXt chunk has unexpected compression method: "
              + compressionMethod);
    int compressedTextLength = bytes.length - index;
    byte compressedText[] = new byte[compressedTextLength];
    System.arraycopy(bytes, index, compressedText, 0,
        compressedTextLength);
    text = new String(new ZLibUtils().inflate(compressedText),
        "ISO-8859-1");
  }
}

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

public PNGChunkzTXt(int length, int chunkType, int crc, byte bytes[])
    throws ImageReadException, IOException
{
  super(length, chunkType, crc, bytes);
  {
    int index = findNull(bytes);
    if (index < 0)
      throw new ImageReadException(
          "PNG zTXt chunk keyword is unterminated.");
    keyword = new String(bytes, 0, index, "ISO-8859-1");
    index++;
    int compressionMethod = bytes[index++];
    if (compressionMethod != PngConstants.COMPRESSION_DEFLATE_INFLATE)
      throw new ImageReadException(
          "PNG zTXt chunk has unexpected compression method: "
              + compressionMethod);
    int compressedTextLength = bytes.length - index;
    byte compressedText[] = new byte[compressedTextLength];
    System.arraycopy(bytes, index, compressedText, 0,
        compressedTextLength);
    text = new String(new ZLibUtils().inflate(compressedText),
        "ISO-8859-1");
  }
}

代码示例来源: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

UncompressedProfile = new ZLibUtils()
    .inflate(CompressedProfile);

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

public final byte[] inflate(byte bytes[]) throws IOException
// slow, probably.
{
  ByteArrayInputStream in = new ByteArrayInputStream(bytes);
  InflaterInputStream zIn = new InflaterInputStream(in);
  return getStreamBytes(zIn);
}

代码示例来源: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

UncompressedProfile = new ZLibUtils()
    .inflate(CompressedProfile);

代码示例来源: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

compressedTextLength);
text = new String(new ZLibUtils().inflate(compressedText),
    "utf-8");

代码示例来源: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

compressedTextLength);
text = new String(new ZLibUtils().inflate(compressedText),
    "utf-8");

代码示例来源: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());
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com