|
Java™ Pretty Printer Library v0.5 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Exc
- The type of exceptions that might be thrown by
this backend.public interface Backend<Exc extends java.lang.Exception>
The backend for a 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.
This interface has a type parameter Exc
which
denotes the type of exceptions that might be thrown when output is
sent to a backend. For instance, a backend like WriterBackend
, which ultimately writes output to a Writer
might produce IOException
s which
should not be handled by the Backend, but passed through to the
program calling the Layouter
. So it implements the
interface Backend<java.io.IOException>
. There is a dummy
exception class NoExceptions
that may be used as parameter
if no checked exceptions are thrown by a Backend.
There is currently no provision to handle proportional fonts, and there might never be.
Layouter
Method Summary | |
---|---|
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. |
Method Detail |
---|
void print(java.lang.String s) throws Exc extends java.lang.Exception
s
to the output. s
contains no newlines.
Exc extends java.lang.Exception
void newLine() throws Exc extends java.lang.Exception
Exc extends java.lang.Exception
void close() throws Exc extends java.lang.Exception
Exc extends java.lang.Exception
void flush() throws Exc extends java.lang.Exception
Exc extends java.lang.Exception
void mark(java.lang.Object o) throws Exc extends java.lang.Exception
mark()
call in the input.
Exc extends java.lang.Exception
int lineWidth()
int measure(java.lang.String s)
s
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |