gpt4 book ai didi

org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.setFallbackToUTF8()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-16 18:58:40 26 4
gpt4 key购买 nike

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

ZipArchiveOutputStream.setFallbackToUTF8介绍

[英]Whether to fall back to UTF and the language encoding flag if the file name cannot be encoded using the specified encoding.

Defaults to false.
[中]如果无法使用指定的编码对文件名进行编码,是否返回UTF和语言编码标志。
默认为false。

代码示例

代码示例来源:origin: stackoverflow.com

ZipArchiveOutputStream ostream = ...; // Your initialization code here
ostream.setEncoding("Cp437"); // This should handle your "special" characters
ostream.setFallbackToUTF8(true); // For "unknown" characters!
ostream.setUseLanguageEncodingFlag(true);                               
ostream.setCreateUnicodeExtraFields(
  ZipArchiveOutputStream.UnicodeExtraFieldPolicy.NOT_ENCODEABLE);

代码示例来源:origin: org.alfresco/alfresco-repository

@Override
public void start(final ExporterContext context)
{
  zipStream = new ZipArchiveOutputStream(outputStream);
  // NOTE: This encoding allows us to workaround bug...
  //       http://bugs.sun.com/bugdatabase/view_bug.do;:WuuT?bug_id=4820807
  zipStream.setEncoding("UTF-8");
  zipStream.setCreateUnicodeExtraFields(UnicodeExtraFieldPolicy.ALWAYS);
  zipStream.setUseLanguageEncodingFlag(true);
  zipStream.setFallbackToUTF8(true);
}

代码示例来源:origin: Alfresco/alfresco-repository

@Override
public void start(final ExporterContext context)
{
  zipStream = new ZipArchiveOutputStream(outputStream);
  // NOTE: This encoding allows us to workaround bug...
  //       http://bugs.sun.com/bugdatabase/view_bug.do;:WuuT?bug_id=4820807
  zipStream.setEncoding("UTF-8");
  zipStream.setCreateUnicodeExtraFields(UnicodeExtraFieldPolicy.ALWAYS);
  zipStream.setUseLanguageEncodingFlag(true);
  zipStream.setFallbackToUTF8(true);
}

代码示例来源:origin: Alfresco/alfresco-repository

public void startExport()
{
  // ALF-2016
  zipStream = new ZipArchiveOutputStream(outputStream);
  // NOTE: This encoding allows us to workaround bug...
  //       http://bugs.sun.com/bugdatabase/view_bug.do;:WuuT?bug_id=4820807
  zipStream.setEncoding("UTF-8");
  zipStream.setCreateUnicodeExtraFields(UnicodeExtraFieldPolicy.ALWAYS);
  zipStream.setUseLanguageEncodingFlag(true);
  zipStream.setFallbackToUTF8(true);
  zipStream.setUseZip64(Zip64Mode.Always);
}

代码示例来源:origin: org.alfresco/alfresco-repository

public void startExport()
{
  // ALF-2016
  zipStream = new ZipArchiveOutputStream(outputStream);
  // NOTE: This encoding allows us to workaround bug...
  //       http://bugs.sun.com/bugdatabase/view_bug.do;:WuuT?bug_id=4820807
  zipStream.setEncoding("UTF-8");
  zipStream.setCreateUnicodeExtraFields(UnicodeExtraFieldPolicy.ALWAYS);
  zipStream.setUseLanguageEncodingFlag(true);
  zipStream.setFallbackToUTF8(true);
  zipStream.setUseZip64(Zip64Mode.Always);
}

代码示例来源:origin: org.apache.ant/ant-compress

private void configure(ZipArchiveOutputStream o) {
  o.setLevel(level);
  o.setComment(comment);
  o.setFallbackToUTF8(fallBackToUTF8);
  o.setUseLanguageEncodingFlag(useLanguageEncodingFlag);
  o.setCreateUnicodeExtraFields(createUnicodeExtraFields.getPolicy());
  o.setUseZip64(zip64Mode.getPolicy());
}

代码示例来源:origin: stackoverflow.com

import java.io.*;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
public class ZipFiles {  
  public static void main(String[] args) throws Exception{
    ZipArchiveOutputStream zipOut = new ZipArchiveOutputStream(new FileOutputStream("测试.zip"));
    zipOut.setEncoding("Cp437"); // This should handle your "special" characters
    zipOut.setFallbackToUTF8(true); // For "unknown" characters!
    zipOut.setUseLanguageEncodingFlag(true);                               
    zipOut.setCreateUnicodeExtraFields(
    ZipArchiveOutputStream.UnicodeExtraFieldPolicy.NOT_ENCODEABLE);
    zipOut.putArchiveEntry(new ZipArchiveEntry("测试.xml"));
    zipOut.putArchiveEntry(new ZipArchiveEntry("test.xml"));
    zipOut.closeArchiveEntry();
    zipOut.flush();
    zipOut.close();
  }
}

代码示例来源:origin: osmlab/atlas

zout.setFallbackToUTF8(true);
zout.setUseLanguageEncodingFlag(true);
if (compress)

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