當前位置: 首頁>>代碼示例>>Java>>正文


Java UnicodeExtraFieldPolicy類代碼示例

本文整理匯總了Java中org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.UnicodeExtraFieldPolicy的典型用法代碼示例。如果您正苦於以下問題:Java UnicodeExtraFieldPolicy類的具體用法?Java UnicodeExtraFieldPolicy怎麽用?Java UnicodeExtraFieldPolicy使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


UnicodeExtraFieldPolicy類屬於org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream包,在下文中一共展示了UnicodeExtraFieldPolicy類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: startExport

import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.UnicodeExtraFieldPolicy; //導入依賴的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.UnicodeExtraFieldPolicy; //導入依賴的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.UnicodeExtraFieldPolicy; //導入依賴的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: createJar

import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.UnicodeExtraFieldPolicy; //導入依賴的package包/類
/**
 * Recursively create JAR archive from directory
 */
public static void createJar(File path, String root, OutputStream os) throws IOException {
	log.debug("createJar({}, {}, {})", new Object[]{path, root, os});

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

		// Prevents java.util.jar.JarException: JAR file must have at least one entry
		JarArchiveEntry jae = new JarArchiveEntry(root + "/");
		jaos.putArchiveEntry(jae);
		jaos.closeArchiveEntry();

		createJarHelper(path, jaos, root);

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

	log.debug("createJar: void");
}
 
開發者ID:openkm,項目名稱:document-management-system,代碼行數:31,代碼來源:ArchiveUtils.java


注:本文中的org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.UnicodeExtraFieldPolicy類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。