Package org.daisy.braille.embosser
Class AbstractEmbosserWriter
java.lang.Object
org.daisy.braille.embosser.AbstractEmbosserWriter
- All Implemented Interfaces:
Closeable,AutoCloseable,EmbosserProperties,EmbosserWriter,EmbosserWriterProperties
- Direct Known Subclasses:
BufferedVolumeEmbosser,ConfigurableEmbosser
Provides an abstract base for embossers.
- Author:
- Joel HÃ¥kansson
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDefines form feed padding style.Nested classes/interfaces inherited from interface org.daisy.braille.embosser.EmbosserProperties
EmbosserProperties.PrintMode -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidadd(byte b) Adds a byte to the EmbosserWriter output.protected abstract voidaddAll(byte[] b) Adds bytes to the EmbosserWriter output.voidclose()intGets the current page number, where the first page is 1.protected voidformFeed()Performs a form feed on the EmbosserWriterabstract LineBreaksGets the line break style for the EmbosserWriterintGets the maximum page height in the current configurationintGets the maximum row width in the current configurationabstract AbstractEmbosserWriter.PaddingGets the form feed padding style for the EmbosserWriterprotected PageBreaksintGets the current row gap, measured as an integer multiple of the dot-to-dot height.abstract BrailleConvertergetTable()Gets the table for the EmbosserWriterprotected voidinit(EmbosserWriterProperties props) booleanisClosed()Tests if embosser has been closedbooleanisOpen()Returns true if embosser is openprotected voidlineFeed()Performs a line feed on the EmbosserWritervoidnewLine()Starts a new linevoidnewPage()Starts a new pagevoidnewSectionAndPage(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 contractvoidOpens for writingbooleanReturns true if page is emptyvoidsetRowGap(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.booleanReturns true if this embosser supports 8 dot braillebooleanReturns true if this embosser supports aligning.booleanReturns true if this embosser supports duplex printingbooleanReturns true if this embosser supports magazine layout.booleanReturns true if this embosser has some method for volume handlingbooleanReturns true if this embosser supports z-folding.voidWrites a string of braille to the embosser.
-
Field Details
-
pagebreaks
-
-
Constructor Details
-
AbstractEmbosserWriter
public AbstractEmbosserWriter()
-
-
Method Details
-
getLinebreakStyle
Gets the line break style for the EmbosserWriter- Returns:
- returns the line break style for the EmbosserWriter
-
getPaddingStyle
Gets the form feed padding style for the EmbosserWriter- Returns:
- returns the padding style for the EmbosserWriter
-
getTable
Gets the table for the EmbosserWriter- Returns:
- returns the table for the EmbosserWriter
-
add
Adds a byte to the EmbosserWriter output.- Parameters:
b- the byte to add- Throws:
IOException- if IO fails.
-
addAll
Adds bytes to the EmbosserWriter output.- Parameters:
b- the bytes to add- Throws:
IOException- if IO fails
-
init
-
newLine
Description copied from interface:EmbosserWriterStarts a new line- Specified by:
newLinein interfaceEmbosserWriter- Throws:
IOException
-
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
-
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
-
open
Description copied from interface:EmbosserWriterOpens for writing using the default contract- Specified by:
openin interfaceEmbosserWriter- Throws:
IOException- if an I/O exception of some sort has occurred
-
open
public void open(boolean duplex, Contract contract) throws IOException, ContractNotSupportedException Description copied from interface:EmbosserWriterOpens for writing- Specified by:
openin interfaceEmbosserWriter- Throws:
IOException- if an I/O exception of some sort has occurredContractNotSupportedException- if the supplied contract is not supported, that is to say if the contract does not contain information required by the implementation
-
currentPage
public int currentPage()Gets the current page number, where the first page is 1.- Returns:
- returns the current page number
-
pageIsEmpty
public boolean pageIsEmpty()Returns true if page is empty- Returns:
- returns true if page is empty
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
write
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
-
lineFeed
Performs a line feed on the EmbosserWriter- Throws:
IOException- if IO fails
-
formFeed
Performs a form feed on the EmbosserWriter- Throws:
IOException- if IO fails
-
getPagebreakStyle
-
newPage
Description copied from interface:EmbosserWriterStarts a new page- Specified by:
newPagein interfaceEmbosserWriter- Throws:
IOException
-
newSectionAndPage
Description copied from interface:EmbosserWriterStarts a new page on a blank sheet of paper with the specified duplex settings.- Specified by:
newSectionAndPagein interfaceEmbosserWriter- Throws:
IOException
-
newVolumeSectionAndPage
Description 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- Throws:
IOException
-
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
-
getMaxHeight
public int getMaxHeight()Description copied from interface:EmbosserWriterPropertiesGets the maximum page height in the current configuration- Specified by:
getMaxHeightin interfaceEmbosserWriterProperties- Returns:
- returns the maximum page height, in rows
-
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
-
supports8dot
public boolean supports8dot()Description copied from interface:EmbosserPropertiesReturns true if this embosser supports 8 dot braille- Specified by:
supports8dotin interfaceEmbosserProperties- Returns:
- returns true if this embosser supports 8 dot braille
-
supportsAligning
public boolean supportsAligning()Description copied from interface:EmbosserPropertiesReturns 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 interfaceEmbosserProperties- Returns:
- returns true if this embosser supports aligning, false otherwise.
-
supportsDuplex
public boolean supportsDuplex()Description copied from interface:EmbosserPropertiesReturns true if this embosser supports duplex printing- Specified by:
supportsDuplexin interfaceEmbosserProperties- Returns:
- returns true if this embosser supports duplex printing
-
supportsVolumes
public boolean supportsVolumes()Description copied from interface:EmbosserPropertiesReturns true if this embosser has some method for volume handling- Specified by:
supportsVolumesin interfaceEmbosserProperties- Returns:
- returns true if this embosser supports volumes
-
supportsZFolding
public boolean supportsZFolding()Description copied from interface:EmbosserPropertiesReturns true if this embosser supports z-folding. This indicates that, if tractor paper is used, the embosser can emboss every other paper upside down with the rear side up so that pages are ordered face up as they fold naturally in the output stack.- Specified by:
supportsZFoldingin interfaceEmbosserProperties- Returns:
- returns true if this embosser supports z-folding, false otherwise.
-
supportsPrintMode
Description copied from interface:EmbosserPropertiesReturns true if this embosser supports magazine layout. This indicates that the embosser can reorder pages and emboss two pages side-by-side on the same side of the paper (and two more on the other side), so that a readable document is created by stapling and folding the output stack in the middle.- Specified by:
supportsPrintModein interfaceEmbosserProperties- Returns:
- returns true if this embosser supports magazine layout, false otherwise.
-