public interface Backend
Layouter
. An object satisfying this
interface can act as a receiver for the layed out text produced by
a Layouter
. A Backend
must also provide the
maximum line width available through the lineWidth()
method. Finally, it is responsible for calculating (with measure(String)
the amount of space it actually needs to print a
given string. For instance, if strings printed through a Layouter
are actually known to be in HTML, measure(String)
can return the size of the text, not including
markup.
There is currently no provision to handle proportional fonts, and there might never be.
Layouter
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this backend
|
void |
flush()
Flushes any buffered output
|
int |
lineWidth()
Returns the available space per line
|
void |
mark(java.lang.Object o)
Gets called to record a
mark() call in the input. |
int |
measure(java.lang.String s)
Returns the space required to print the String
s |
void |
newLine()
Start a new line.
|
void |
print(java.lang.String s)
Append a String
s to the output. |
void print(java.lang.String s) throws java.io.IOException
s
to the output. s
contains no newlines.java.io.IOException
void newLine() throws java.io.IOException
java.io.IOException
void close() throws java.io.IOException
java.io.IOException
void flush() throws java.io.IOException
java.io.IOException
void mark(java.lang.Object o)
mark()
call in the input.int lineWidth()
int measure(java.lang.String s)
s