コード例 #1
0
ファイル: Resource.java プロジェクト: abourazanis/epublib
 /**
  * Creates a resource with the data from the given InputStream at the specified href. The
  * MediaType will be determined based on the href extension.
  *
  * @see nl.siegmann.epublib.service.MediatypeService.determineMediaType(String)
  *     <p>Assumes that if the data is of a text type (html/css/etc) then the encoding will be
  *     UTF-8
  *     <p>It is recommended to us the
  * @see nl.siegmann.epublib.domain.Resource.Resource(Reader, String) method for creating textual
  *     (html/css/etc) resources to prevent encoding problems. Use this method only for binary
  *     Resources like images, fonts, etc.
  * @param in The Resource's contents
  * @param href The location of the resource within the epub. Example: "cover.jpg".
  */
 public Resource(Reader in, String href) throws IOException {
   this(
       null,
       IOUtil.toByteArray(in, Constants.ENCODING),
       href,
       MediatypeService.determineMediaType(href),
       Constants.ENCODING);
 }
コード例 #2
0
ファイル: Resource.java プロジェクト: abourazanis/epublib
 /**
  * Creates a resource with the data from the given Reader at the specified href. The MediaType
  * will be determined based on the href extension.
  *
  * @see nl.siegmann.epublib.service.MediatypeService.determineMediaType(String)
  * @param in The Resource's contents
  * @param href The location of the resource within the epub. Example: "cover.jpg".
  */
 public Resource(InputStream in, String href) throws IOException {
   this(null, IOUtil.toByteArray(in), href, MediatypeService.determineMediaType(href));
 }