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


Java Resource.setInputEncoding方法代码示例

本文整理汇总了Java中nl.siegmann.epublib.domain.Resource.setInputEncoding方法的典型用法代码示例。如果您正苦于以下问题:Java Resource.setInputEncoding方法的具体用法?Java Resource.setInputEncoding怎么用?Java Resource.setInputEncoding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nl.siegmann.epublib.domain.Resource的用法示例。


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

示例1: loadResources

import nl.siegmann.epublib.domain.Resource; //导入方法依赖的package包/类
/**
 * Loads all entries from the ZipInputStream as Resources.
 * 
 * Loads the contents of all ZipEntries into memory.
 * Is fast, but may lead to memory problems when reading large books on devices with small amounts of memory.
 * 
 * @param zipInputStream
 * @param defaultHtmlEncoding
 * @return
 * @throws IOException
 */
public static Resources loadResources(ZipInputStream zipInputStream, String defaultHtmlEncoding) throws IOException {
	Resources result = new Resources();
	ZipEntry zipEntry;
	do {
		// get next valid zipEntry
		zipEntry = getNextZipEntry(zipInputStream);
		if((zipEntry == null) || (zipEntry == ERROR_ZIP_ENTRY) || zipEntry.isDirectory()) {
			continue;
		}
		
		// store resource
		Resource resource = ResourceUtil.createResource(zipEntry, zipInputStream);
		if(resource.getMediaType() == MediatypeService.XHTML) {
			resource.setInputEncoding(defaultHtmlEncoding);
		}
		result.add(resource);
	} while(zipEntry != null);

	return result;
}
 
开发者ID:DASAR,项目名称:epublib-android,代码行数:32,代码来源:ResourcesLoader.java

示例2: cleanupResource

import nl.siegmann.epublib.domain.Resource; //导入方法依赖的package包/类
private void cleanupResource(Resource resource, Book book) throws IOException {
	if(resource.getMediaType() == MediatypeService.XHTML) {
		byte[] cleanedHtml = processHtml(resource, book, Constants.CHARACTER_ENCODING);
		resource.setData(cleanedHtml);
		resource.setInputEncoding(Constants.CHARACTER_ENCODING);
	}
}
 
开发者ID:DASAR,项目名称:epublib-android,代码行数:8,代码来源:HtmlBookProcessor.java

示例3: createResource

import nl.siegmann.epublib.domain.Resource; //导入方法依赖的package包/类
public static Resource createResource(FileObject rootDir, FileObject file, String inputEncoding) throws IOException {
	MediaType mediaType = MediatypeService.determineMediaType(file.getName().getBaseName());
	if(mediaType == null) {
		return null;
	}
	String href = calculateHref(rootDir, file);
	Resource result = new Resource(null, IOUtils.toByteArray(file.getContent().getInputStream()), href, mediaType);
	result.setInputEncoding(inputEncoding);
	return result;
}
 
开发者ID:DASAR,项目名称:epublib-android,代码行数:11,代码来源:VFSUtil.java


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