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 void
newPage()
Inserts a new page in the output format, if applicablevoid
newRow()
Add a new empty row to the current pagevoid
newRow(Row row)
Add a new row to the current pagevoid
newSection(SectionProperties props)
Insert a new section in the output format, if applicablevoid
newVolume(SectionProperties props)
Inserts a new volume in the output format, if applicablevoid
open(OutputStream os)
Open the PagedMediaWriter for writing.void
prepare(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
-
-