Class IndexContractEmbosserWriter
- java.lang.Object
-
- org.daisy.braille.utils.impl.provider.indexbraille.IndexContractEmbosserWriter
-
- All Implemented Interfaces:
Closeable,AutoCloseable,ContractEmbosserWriter,EmbosserWriter,EmbosserWriterProperties
public class IndexContractEmbosserWriter extends Object implements ContractEmbosserWriter
Provides an embosser writer that supports different configurations based on the properties of anInternalContract.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()intgetMaxWidth()Gets the maximum row width in the current configuration.intgetRowGap()Gets the current row gap, measured as an integer multiple of the dot-to-dot height.booleanisClosed()Tests if embosser has been closed.booleanisOpen()Returns true if embosser is open.voidnewLine()Starts a new line.voidnewPage()Starts a new page.voidnewSectionAndPage(boolean duplex)Starts a new page on a blank sheet of paper with the specified duplex settings.voidnewVolumeSectionAndPage(boolean duplex)Starts a new page on a blank sheet of paper in a new volume with the specified duplex settings.voidopen(boolean duplex)Opens for writing using the default contract.voidopen(boolean duplex, InternalContract contract)Opens for writing using the specified contract.voidsetRowGap(int value)Sets the row gap for following calls to newLine to the specified value, measured as an integer multiple of the dot-to-dot height.booleansupportsAligning()Returns true if this embosser supports aligning.voidwrite(String braille)Writes a string of braille to the embosser.
-
-
-
Method Detail
-
open
public void open(boolean duplex) throws IOExceptionDescription copied from interface:EmbosserWriterOpens for writing using the default contract.- Specified by:
openin interfaceEmbosserWriter- Parameters:
duplex- true if both sides of sheets should be used, false otherwise- Throws:
IOException- if an I/O error occurs
-
open
public void open(boolean duplex, InternalContract contract) throws IOException, InternalContractNotSupportedExceptionDescription copied from interface:ContractEmbosserWriterOpens for writing using the specified contract.- Specified by:
openin interfaceContractEmbosserWriter- Parameters:
duplex- if both sides of sheets should be used, false otherwisecontract- the contract- Throws:
IOException- if an I/O exception of some sort has occurredInternalContractNotSupportedException- if the supplied contract is not supported, that is to say if the contract does not contain information required by the implementation
-
write
public void write(String braille) throws IOException
Description copied from interface:EmbosserWriterWrites a string of braille to the embosser. Values must be between 0x2800 and 0x28FF. An implementation may supply a complete row of braille in a single chunk. However, an implementation may also call this method repeatedly without any other calls in between.- Specified by:
writein interfaceEmbosserWriter- Parameters:
braille- characters in the range 0x2800 to 0x28FF- Throws:
IOException- if an I/O error occurs
-
newLine
public void newLine() throws IOExceptionDescription copied from interface:EmbosserWriterStarts a new line.- Specified by:
newLinein interfaceEmbosserWriter- Throws:
IOException- if an I/O error occurs
-
setRowGap
public void setRowGap(int value)
Description copied from interface:EmbosserWriterSets the row gap for following calls to newLine to the specified value, measured as an integer multiple of the dot-to-dot height.- Specified by:
setRowGapin interfaceEmbosserWriter- Parameters:
value- the row gap
-
getRowGap
public int getRowGap()
Description copied from interface:EmbosserWriterGets the current row gap, measured as an integer multiple of the dot-to-dot height.- Specified by:
getRowGapin interfaceEmbosserWriter- Returns:
- returns the current row gap
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
newPage
public void newPage() throws IOExceptionDescription copied from interface:EmbosserWriterStarts a new page.- Specified by:
newPagein interfaceEmbosserWriter- Throws:
IOException- if an I/O error occurs
-
newSectionAndPage
public void newSectionAndPage(boolean duplex) throws IOExceptionDescription copied from interface:EmbosserWriterStarts a new page on a blank sheet of paper with the specified duplex settings.- Specified by:
newSectionAndPagein interfaceEmbosserWriter- Parameters:
duplex- if both sides of sheets should be used, false otherwise- Throws:
IOException- if an I/O error occurs
-
newVolumeSectionAndPage
public void newVolumeSectionAndPage(boolean duplex) throws IOExceptionDescription copied from interface:EmbosserWriterStarts a new page on a blank sheet of paper in a new volume with the specified duplex settings.- Specified by:
newVolumeSectionAndPagein interfaceEmbosserWriter- Parameters:
duplex- if both sides of sheets should be used, false otherwise- Throws:
IOException- if an I/O error occurs
-
isOpen
public boolean isOpen()
Description copied from interface:EmbosserWriterReturns true if embosser is open.- Specified by:
isOpenin interfaceEmbosserWriter- Returns:
- returns true if embosser is open, false otherwise
-
isClosed
public boolean isClosed()
Description copied from interface:EmbosserWriterTests if embosser has been closed.- Specified by:
isClosedin interfaceEmbosserWriter- Returns:
- returns true if the embosser has been open, but is now closed, false otherwise
-
getMaxWidth
public int getMaxWidth()
Description copied from interface:EmbosserWriterPropertiesGets the maximum row width in the current configuration.- Specified by:
getMaxWidthin interfaceEmbosserWriterProperties- Returns:
- returns the maximum row width, in characters
-
supportsAligning
public boolean supportsAligning()
Description copied from interface:EmbosserWriterPropertiesReturns true if this embosser supports aligning. This indicates that rows can be padded with whitespace to move the text block horizontally using the value returned bygetMaxWidth. Should return true for all physical embossers, since they all have a finite row length.- Specified by:
supportsAligningin interfaceEmbosserWriterProperties- Returns:
- returns true if this embosser supports aligning, false otherwise.
-
-