Class LastTwoLinesAwareWriter
java.lang.Object
java.io.Writer
org.apache.maven.doxia.module.markdown.LastTwoLinesAwareWriter
- All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable
Decorates an existing writer to additionally temporarily buffer the last two lines written.
Useful to collapse subsequent new lines or blank lines by evaluating
isWriterAfterBlankLine() and isWriterAfterBlankLine().
The buffering does not affect or defer delegation to the underlying writer, though.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringBuilderprivate final Stringprivate final Writerprivate String -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
out
-
previousLine
-
currentLine
-
lineSeparator
-
-
Constructor Details
-
LastTwoLinesAwareWriter
-
LastTwoLinesAwareWriter
-
-
Method Details
-
isWriterAtStartOfNewLine
public boolean isWriterAtStartOfNewLine() -
isWriterAfterBlankLine
public boolean isWriterAfterBlankLine() -
isInBlankLine
public boolean isInBlankLine() -
write
- Specified by:
writein classWriter- Throws:
IOException
-
flushLine
private void flushLine(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
-
isAfterDigit
public boolean isAfterDigit()
-