Package org.daisy.dotify.api.writer
Interface PagedMediaWriter
-
- All Superinterfaces:
AutoCloseable,Closeable
public interface PagedMediaWriter extends Closeable
PagedMediaWriter is an interface for writing to a paged media.
An implementation of PagedMediaWriter is responsible for writing volumes, sections, pages and rows in a specific format.
The PagedMediaWriter must not alter the input structure. For example, an implementation of PagedMediaWriter must not break a page unless instructed via
newPage().
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidnewPage()Inserts a new page in the output format, if applicablevoidnewRow()Add a new empty row to the current pagevoidnewRow(Row row)Add a new row to the current pagevoidnewSection(SectionProperties props)Insert a new section in the output format, if applicablevoidnewVolume(SectionProperties props)Inserts a new volume in the output format, if applicablevoidopen(OutputStream os)Open the PagedMediaWriter for writing.voidprepare(List<MetaDataItem> meta)Adds additional metadata items.
-
-
-
Method Detail
-
newVolume
void newVolume(SectionProperties props)
Inserts a new volume in the output format, if applicable- Parameters:
props- the section properties- Throws:
IllegalStateException- if writer is not opened or if writer has been closed
-
newSection
void newSection(SectionProperties props)
Insert a new section in the output format, if applicable- Parameters:
props- the SectionProperties for this section- Throws:
IllegalStateException- if writer is not opened or if writer has been closed
-
newPage
void newPage()
Inserts a new page in the output format, if applicable- Throws:
IllegalStateException- if writer is not opened or if writer has been closed
-
newRow
void newRow(Row row)
Add a new row to the current page- Parameters:
row- the row- Throws:
IllegalStateException- if writer is not opened or if writer has been closed
-
newRow
void newRow()
Add a new empty row to the current page- Throws:
IllegalStateException- if writer is not opened or if writer has been closed
-
prepare
void prepare(List<MetaDataItem> meta)
Adds additional metadata items. Must be called before opening the writer. Multiple calls to prepare will append to the existing list of metadata.- Parameters:
meta- a list of metadata- Throws:
IllegalStateException- if writer has been opened
-
open
void open(OutputStream os) throws PagedMediaWriterException
Open the PagedMediaWriter for writing. Must be called before writing to the writer.- Parameters:
os- The underlying OutputStream for the PagedMediaWriter- Throws:
PagedMediaWriterException- throws an PagedMediaWriterException if the PagedMediaWriter could not be openedIllegalStateException- if writer has already been opened
-
-