Package monq.jfa.ooo
Class ContextBufferingWriter
java.lang.Object
java.io.Writer
monq.jfa.ooo.ContextBufferingWriter
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
A writer which keeps a pre- and and a post-context of a marked "line" and writes the "line" out
in the context as soon as the required context has been seen. If contexts overlap, the
overlapping parts are written for each marked line.
NOTE: this class is mainly final because of "Final classes are immune to finalizer attacks..." from Effective java, Item 8.
-
Constructor Summary
ConstructorsConstructorDescriptionContextBufferingWriter(Writer sink, int preContext, int postContext, String separator) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()voidpushPartition(boolean withMatch) voidwrite(char[] cbuf, int off, int len)
-
Constructor Details
-
ContextBufferingWriter
-
-
Method Details
-
pushPartition
- Throws:
IOException
-
write
public void write(char[] cbuf, int off, int len) -
flush
- Specified by:
flushin interfaceFlushable- Specified by:
flushin classWriter- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classWriter- Throws:
IOException
-