当前位置: 首页>>代码示例>>Java>>正文


Java ZipArchiveOutputStream.setCreateUnicodeExtraFields方法代码示例

本文整理汇总了Java中org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.setCreateUnicodeExtraFields方法的典型用法代码示例。如果您正苦于以下问题:Java ZipArchiveOutputStream.setCreateUnicodeExtraFields方法的具体用法?Java ZipArchiveOutputStream.setCreateUnicodeExtraFields怎么用?Java ZipArchiveOutputStream.setCreateUnicodeExtraFields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream的用法示例。


在下文中一共展示了ZipArchiveOutputStream.setCreateUnicodeExtraFields方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startExport

import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; //导入方法依赖的package包/类
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);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:13,代码来源:ACPExportPackageHandler.java

示例2: start

import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; //导入方法依赖的package包/类
@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);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:ZipDownloadExporter.java

示例3: createZip

import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; //导入方法依赖的package包/类
/**
 * Create ZIP archive from file
 */
public static void createZip(File path, OutputStream os) throws IOException {
	log.debug("createZip({}, {})", new Object[]{path, os});

	if (path.exists() && path.canRead()) {
		ZipArchiveOutputStream zaos = new ZipArchiveOutputStream(os);
		zaos.setComment("Generated by OpenKM");
		zaos.setCreateUnicodeExtraFields(UnicodeExtraFieldPolicy.ALWAYS);
		zaos.setUseLanguageEncodingFlag(true);
		zaos.setFallbackToUTF8(true);
		zaos.setEncoding("UTF-8");

		log.debug("FILE {}", path);
		ZipArchiveEntry zae = new ZipArchiveEntry(path.getName());
		zaos.putArchiveEntry(zae);
		FileInputStream fis = new FileInputStream(path);
		IOUtils.copy(fis, zaos);
		fis.close();
		zaos.closeArchiveEntry();

		zaos.flush();
		zaos.finish();
		zaos.close();
	} else {
		throw new IOException("Can't access " + path);
	}

	log.debug("createZip: void");
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:32,代码来源:ArchiveUtils.java

示例4: zip

import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; //导入方法依赖的package包/类
public void zip( File fileOrDirectoryToZip, File targetFile, Charset charset ) {

        try {

            ZipArchiveOutputStream stream = new ZipArchiveOutputStream( targetFile );

            stream.setEncoding( charset.name() );

            stream.setCreateUnicodeExtraFields( ZipArchiveOutputStream.UnicodeExtraFieldPolicy.ALWAYS );

            compress( fileOrDirectoryToZip, stream );

        } catch( IOException e ) {

            throw new UncheckedIOException( e );
        }

    }
 
开发者ID:NyBatis,项目名称:NyBatisCore,代码行数:19,代码来源:ZipFileHandler.java


注:本文中的org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.setCreateUnicodeExtraFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。