public class TextFilePrinterDriver extends Object implements PrinterDriver
Constructor and Description |
---|
TextFilePrinterDriver(OutputStream out,
float charsPerInch,
float linesPerInch) |
TextFilePrinterDriver(OutputStream out,
float charsPerInch,
float linesPerInch,
boolean unixEndOfLine) |
Modifier and Type | Method and Description |
---|---|
void |
endLine(boolean overflow)
Ends a new line.
|
void |
endPage(boolean overflow)
Ends the current page.
|
void |
flush()
Flushes the output stream.
|
float |
getCharactersPerInch()
Gets the default character width in CPI.
|
char[] |
getEndOfLine() |
char[] |
getEndOfPage() |
float |
getLinesPerInch()
Gets the default line height.
|
void |
printChunk(PlaintextDataChunk chunk)
Prints a single text chunk at the given position on the current line.
|
void |
printEmptyChunk(int count)
Prints an empty chunk.
|
void |
printRaw(byte[] raw)
Prints some raw content.
|
void |
setEndOfLine(char[] endOfLine) |
void |
setEndOfPage(char[] endOfPage) |
void |
startLine()
Starts a new line.
|
void |
startPage(Paper paper,
String encoding)
Resets the printer and starts a new page.
|
public TextFilePrinterDriver(OutputStream out, float charsPerInch, float linesPerInch)
public TextFilePrinterDriver(OutputStream out, float charsPerInch, float linesPerInch, boolean unixEndOfLine)
public void endLine(boolean overflow) throws IOException
endLine
in interface PrinterDriver
overflow
- IOException
- if an IOError occures.public void endPage(boolean overflow) throws IOException
endPage
in interface PrinterDriver
overflow
- IOException
- if there was an IOError while writing the commandpublic void flush() throws IOException
flush
in interface PrinterDriver
IOException
- if an IOError occured.public float getCharactersPerInch()
getCharactersPerInch
in interface PrinterDriver
public float getLinesPerInch()
getLinesPerInch
in interface PrinterDriver
public void printChunk(PlaintextDataChunk chunk) throws IOException
printChunk
in interface PrinterDriver
chunk
- the chunk that should be writtenIOException
- if an IO error occured.public void printEmptyChunk(int count) throws IOException
printEmptyChunk
in interface PrinterDriver
IOException
- if an IOError occured.public void printRaw(byte[] raw) throws IOException
printRaw
in interface PrinterDriver
raw
- the content that should be printed.IOException
public void startLine() throws IOException
startLine
in interface PrinterDriver
IOException
- if an IOError occures.public void startPage(Paper paper, String encoding) throws IOException
startPage
in interface PrinterDriver
IOException
- if there was an IOError while writing the commandpublic char[] getEndOfLine()
public void setEndOfLine(char[] endOfLine)
public char[] getEndOfPage()
public void setEndOfPage(char[] endOfPage)