Package nl.siegmann.epublib.epub
Class EpubWriter
- java.lang.Object
-
- nl.siegmann.epublib.epub.EpubWriter
-
public class EpubWriter extends java.lang.ObjectGenerates an epub file. Not thread-safe, single use object.
-
-
Field Summary
Fields Modifier and Type Field Description private BookProcessorbookProcessor(package private) static java.lang.StringEMPTY_NAMESPACE_PREFIXprivate static org.slf4j.Loggerlog
-
Constructor Summary
Constructors Constructor Description EpubWriter()EpubWriter(BookProcessor bookProcessor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private longcalculateCrc(byte[] data)BookProcessorgetBookProcessor()(package private) java.lang.StringgetNcxHref()(package private) java.lang.StringgetNcxId()(package private) java.lang.StringgetNcxMediaType()private voidinitTOCResource(Book book)private BookprocessBook(Book book)voidsetBookProcessor(BookProcessor bookProcessor)voidwrite(Book book, java.io.OutputStream out)private voidwriteContainer(java.util.zip.ZipOutputStream resultStream)Writes the META-INF/container.xml file.private voidwriteMimeType(java.util.zip.ZipOutputStream resultStream)Stores the mimetype as an uncompressed file in the ZipOutputStream.private voidwritePackageDocument(Book book, java.util.zip.ZipOutputStream resultStream)private voidwriteResource(Resource resource, java.util.zip.ZipOutputStream resultStream)Writes the resource to the resultStream.private voidwriteResources(Book book, java.util.zip.ZipOutputStream resultStream)
-
-
-
Field Detail
-
log
private static final org.slf4j.Logger log
-
EMPTY_NAMESPACE_PREFIX
static final java.lang.String EMPTY_NAMESPACE_PREFIX
- See Also:
- Constant Field Values
-
bookProcessor
private BookProcessor bookProcessor
-
-
Constructor Detail
-
EpubWriter
public EpubWriter()
-
EpubWriter
public EpubWriter(BookProcessor bookProcessor)
-
-
Method Detail
-
write
public void write(Book book, java.io.OutputStream out) throws java.io.IOException
- Throws:
java.io.IOException
-
initTOCResource
private void initTOCResource(Book book)
-
writeResources
private void writeResources(Book book, java.util.zip.ZipOutputStream resultStream) throws java.io.IOException
- Throws:
java.io.IOException
-
writeResource
private void writeResource(Resource resource, java.util.zip.ZipOutputStream resultStream) throws java.io.IOException
Writes the resource to the resultStream.- Parameters:
resource-resultStream-- Throws:
java.io.IOException
-
writePackageDocument
private void writePackageDocument(Book book, java.util.zip.ZipOutputStream resultStream) throws java.io.IOException
- Throws:
java.io.IOException
-
writeContainer
private void writeContainer(java.util.zip.ZipOutputStream resultStream) throws java.io.IOExceptionWrites the META-INF/container.xml file.- Parameters:
resultStream-- Throws:
java.io.IOException
-
writeMimeType
private void writeMimeType(java.util.zip.ZipOutputStream resultStream) throws java.io.IOExceptionStores the mimetype as an uncompressed file in the ZipOutputStream.- Parameters:
resultStream-- Throws:
java.io.IOException
-
calculateCrc
private long calculateCrc(byte[] data)
-
getNcxId
java.lang.String getNcxId()
-
getNcxHref
java.lang.String getNcxHref()
-
getNcxMediaType
java.lang.String getNcxMediaType()
-
getBookProcessor
public BookProcessor getBookProcessor()
-
setBookProcessor
public void setBookProcessor(BookProcessor bookProcessor)
-
-