|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.Writer java.io.PrintWriter org.sadun.util.PrefixPrintWriter
A PrintWriter that unconditionally prefixes any new line of output with a given prefix.
The prefix may be a constant string, or computed on each invocation
if a PrefixProvider
object is given at construction
Nested Class Summary | |
static class |
PrefixPrintWriter.DirectoryPrefixProvider
A prefix provider to show the current directory as a prefix. |
Field Summary | |
static org.sadun.util.PrefixPrintWriter.TimePrefixProvider |
TIME_PREFIXPROVIDER
A built-in provider which prefixes the output with time information |
Fields inherited from class java.io.PrintWriter |
out |
Fields inherited from class java.io.Writer |
lock |
Constructor Summary | |
PrefixPrintWriter(java.io.OutputStream os,
PrefixProvider pp)
Build a PrefixPrintWriter which wraps the given output stream, and use the given PrefixProvider
to determine the prefix. |
|
PrefixPrintWriter(java.io.OutputStream os,
java.lang.String prefix)
Build a PrefixPrintWriter which wraps the given output stream, and prefixes lines with the given constant string |
|
PrefixPrintWriter(java.io.Writer w,
PrefixProvider pp)
Build a PrefixPrintWriter which wraps the given writer, and use the given PrefixProvider
to determine the prefix. |
|
PrefixPrintWriter(java.io.Writer w,
java.lang.String prefix)
Build a PrefixPrintWriter which wraps the given writer, and prefixes lines with the given constant string |
Method Summary | |
static void |
main(java.lang.String[] args)
|
void |
println()
Terminate the current line by writing the line separator string. |
void |
write(char[] buf,
int off,
int len)
Write a portion of character array, of given length from a given offset |
void |
write(int c)
Write a character |
void |
write(java.lang.String s,
int off,
int len)
Write a substring of a string, of given length from a given offset |
Methods inherited from class java.io.PrintWriter |
checkError, close, flush, print, print, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, println, setError, write, write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final org.sadun.util.PrefixPrintWriter.TimePrefixProvider TIME_PREFIXPROVIDER
Constructor Detail |
public PrefixPrintWriter(java.io.Writer w, PrefixProvider pp)
PrefixProvider
to determine the prefix.
w
- the writer to wrap onpp
- the PrefixProvider
providing the prefix for each linepublic PrefixPrintWriter(java.io.Writer w, java.lang.String prefix)
w
- the writer to wrap onprefix
- the prefix for each linepublic PrefixPrintWriter(java.io.OutputStream os, PrefixProvider pp)
PrefixProvider
to determine the prefix.
os
- the output stream to wrap onpp
- the PrefixProvider
providing the prefix for each linepublic PrefixPrintWriter(java.io.OutputStream os, java.lang.String prefix)
os
- the output stream to wrap onprefix
- the prefix for each lineMethod Detail |
public void write(int c)
public void write(java.lang.String s, int off, int len)
public void write(char[] buf, int off, int len)
public void println()
line.separator
, and is not necessarily a single newline
character ('\n'
).
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |