public class LineNumberWriter extends Writer
| Modifier and Type | Class and Description |
|---|---|
static class |
LineNumberWriter.LineNumberEvent
Event to be used by the LineNumberListener interface.
|
static interface |
LineNumberWriter.LineNumberListener
LineNumberListener interface can inform a listener about changes in the
line number, or when a linenumber limit has been reached.
|
| Constructor and Description |
|---|
LineNumberWriter(Writer out)
Creates a Line Number Writer
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLineNumberListener(LineNumberWriter.LineNumberListener listener,
int lineNoLimit)
Add a LineNumberListener
|
void |
close() |
void |
flush() |
int |
getLineNumber()
Returns the line number that is currently being written.
|
void |
setLineNumber(int lineNo)
Set the current line number
|
void |
write(char[] cbuf) |
void |
write(char[] cbuf,
int off,
int len) |
void |
write(int c) |
void |
write(String str) |
void |
write(String str,
int off,
int len) |
public LineNumberWriter(Writer out)
out - writer to write topublic void write(char[] cbuf)
throws IOException
write in class WriterIOExceptionpublic void write(char[] cbuf,
int off,
int len)
throws IOException
write in class WriterIOExceptionpublic void write(String str) throws IOException
write in class WriterIOExceptionpublic void write(String str, int off, int len) throws IOException
write in class WriterIOExceptionpublic void write(int c)
throws IOException
write in class WriterIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class WriterIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class WriterIOExceptionpublic int getLineNumber()
public void setLineNumber(int lineNo)
lineNo - new line numberpublic void addLineNumberListener(LineNumberWriter.LineNumberListener listener, int lineNoLimit) throws TooManyListenersException
listener - new listenerlineNoLimit - line number for which to generate a LineNumberEventTooManyListenersException - if there is more than one listenerCopyright © 2016. All rights reserved.