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


Java Resource.getHref方法代码示例

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


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

示例1: read

import nl.siegmann.epublib.domain.Resource; //导入方法依赖的package包/类
public static void read(Resource packageResource, EpubReader epubReader, Book book, Resources resources) throws UnsupportedEncodingException, SAXException, IOException, ParserConfigurationException {
	Document packageDocument = ResourceUtil.getAsDocument(packageResource);
	String packageHref = packageResource.getHref();
	resources = fixHrefs(packageHref, resources);
	readGuide(packageDocument, epubReader, book, resources);
	
	// Books sometimes use non-identifier ids. We map these here to legal ones
	Map<String, String> idMapping = new HashMap<String, String>();
	
	resources = readManifest(packageDocument, packageHref, epubReader, resources, idMapping);
	book.setResources(resources);
	readCover(packageDocument, book);
	book.setMetadata(PackageDocumentMetadataReader.readMetadata(packageDocument));
	book.setSpine(readSpine(packageDocument, epubReader, book.getResources(), idMapping));
	
	// if we did not find a cover page then we make the first page of the book the cover page
	if (book.getCoverPage() == null && book.getSpine().size() > 0) {
		book.setCoverPage(book.getSpine().getResource(0));
	}
}
 
开发者ID:DASAR,项目名称:epublib-android,代码行数:21,代码来源:PackageDocumentReader.java

示例2: addResource

import nl.siegmann.epublib.domain.Resource; //导入方法依赖的package包/类
/**
 * Adds a new resource.
 * @param resource
 */
private void addResource( Resource resource ) {
	
	SpineEntry newEntry = new SpineEntry();
	newEntry.title = resource.getTitle();
	newEntry.resource = resource;
	newEntry.href = resource.getHref();
	newEntry.size = (int) resource.getSize();
	
	entries.add(newEntry);
}
 
开发者ID:benjamarle,项目名称:typhon,代码行数:15,代码来源:TyphonSpine.java

示例3: resolveHref

import nl.siegmann.epublib.domain.Resource; //导入方法依赖的package包/类
/**
 * Resolves a href relative to the current resource.
 * 
 * @param href
 * @return
 */
public String resolveHref( String href ) {		
	
	Option<Resource> res = getCurrentResource();

       if (! isEmpty(res) ) {
           Resource actualResource = res.unsafeGet();

           if ( actualResource.getHref() != null ) {
               return resolveHref(href, actualResource.getHref());
           }
       }

       return href;
}
 
开发者ID:benjamarle,项目名称:typhon,代码行数:21,代码来源:TyphonSpine.java

示例4: getTitle

import nl.siegmann.epublib.domain.Resource; //导入方法依赖的package包/类
public static String getTitle(Resource resource) {
	if (resource == null) {
		return "";
	}
	if (resource.getMediaType() != MediatypeService.XHTML) {
		return resource.getHref();
	}
	String title = findTitleFromXhtml(resource);
	if (title == null) {
		title = "";
	}
	return title;
}
 
开发者ID:DASAR,项目名称:epublib-android,代码行数:14,代码来源:ToolsResourceUtil.java

示例5: getResourceContent

import nl.siegmann.epublib.domain.Resource; //导入方法依赖的package包/类
/**
 * returns the file input stream of a resources located in an epub
 * in difference to {@link Resource#getData()} the stream is not cached in memory
 */
public InputStream getResourceContent(Resource resource) throws FileNotFoundException {
    File file = new File(getOpfPath(), resource.getHref());
    return new FileInputStream(file);
}
 
开发者ID:smartmobilefactory,项目名称:EpubReaderAndroid,代码行数:9,代码来源:Epub.java


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