public class LineFormattingAppendableImpl extends Object implements LineFormattingAppendable
ALLOW_LEADING_EOL, ALLOW_LEADING_WHITESPACE, COLLAPSE_WHITESPACE, CONVERT_TABS, FORMAT_ALL, PASS_THROUGH, PREFIX_AFTER_PENDING_EOL, PREFIX_PRE_FORMATTED, SUPPRESS_TRAILING_WHITESPACE| Constructor and Description |
|---|
LineFormattingAppendableImpl(int formatOptions) |
| Modifier and Type | Method and Description |
|---|---|
LineFormattingAppendable |
addIndentOnFirstEOL(Runnable runnable) |
LineFormattingAppendable |
addLine()
Add a new line or blank lines as needed.
|
LineFormattingAppendable |
addPrefix(CharSequence prefix,
boolean afterEol)
Add to prefix appended after a new line character for every line
and after a new line in pre-formatted sections
|
LineFormattingAppendable |
append(char c) |
LineFormattingAppendable |
append(CharSequence csq) |
LineFormattingAppendable |
append(CharSequence csq,
int start,
int end) |
LineFormattingAppendable |
append(LineFormattingAppendable lineAppendable,
int startLine,
int endLine)
Append lines with given prefix
|
LineFormattingAppendable |
appendTo(Appendable out,
int maxBlankLines,
CharSequence prefix,
int startLine,
int endLine)
append lines to appendable with given maximum trailing blank lines and given prefix to add to all lines
|
LineFormattingAppendable |
blankLine()
Add a blank line, if there is not one already appended.
|
LineFormattingAppendable |
blankLine(int count)
Add a blank lines, if there isn't already given number of blank lines appended.
|
LineFormattingAppendable |
blankLineIf(boolean predicate)
Add a blank line, if predicate is true and there isn't already blank lines appended.
|
LineFormattingAppendable |
closePreFormatted()
Close preformatted section and suspend content modification
|
int |
column()
Get column offset after last append
|
CharSequence |
getIndentPrefix()
Get prefix appended after a new line character for every indent level
|
List<CharSequence> |
getLineContents(int startOffset,
int endOffset)
Get Lines without prefixes or EOL
|
int |
getLineCount()
Get the number of lines appended, does not include pending: EOLs
|
List<BasedSequence> |
getLinePrefixes(int startOffset,
int endOffset)
Get Line prefixes
|
List<CharSequence> |
getLines(int startOffset,
int endOffset)
Get Lines without EOL
|
int |
getOptions()
Get current options
|
int |
getPendingEOL()
Get number of EOLs at end of text (including pending text)
|
int |
getPendingSpace()
Get trailing spaces or tabs of trailing text
|
CharSequence |
getPrefix()
Get prefix being applied to all lines, even in pre-formatted sections
|
LineFormattingAppendable |
indent()
Increase the indent level, will terminate the current line if there is unterminated text
|
boolean |
isPendingSpace()
Test if trailing text ends in space or tab
|
boolean |
isPreFormatted() |
boolean |
isPreFormattedLine(int line)
Test if given line is part of pre-formatted text
|
LineFormattingAppendable |
line()
Add a new line, if there was any unterminated text appended
|
LineFormattingAppendable |
lineIf(boolean predicate)
Add a new line, if predicate is true and there was any unterminated text appended
|
LineFormattingAppendable |
lineOnFirstText(boolean value) |
LineFormattingAppendable |
lineWithTrailingSpaces(int count)
Add a new line, keep trailing spaces if there was any unterminated text appended
|
int |
offset()
Get text offset of all output lines (not including any text not included because it is not yet terminated by line() call)
NOTE: this includes prefixes
|
int |
offsetWithPending()
Get column offset after last append
NOTE: this includes prefixes
|
LineFormattingAppendable |
openPreFormatted(boolean addPrefixToFirstLine)
Open preformatted section and suspend content modification
|
LineFormattingAppendable |
popPrefix(boolean afterEol)
Pop a prefix from the stack and set the current prefix
|
LineFormattingAppendable |
prefixLines(CharSequence prefix,
boolean addAfterLinePrefix,
int startLine,
int endLine)
Add prefix to selected lines either before the line prefix or after it
|
LineFormattingAppendable |
pushPrefix()
Save the current prefix on the stack
|
LineFormattingAppendable |
removeIndentOnFirstEOL(Runnable runnable) |
LineFormattingAppendable |
removeLines(int startLine,
int endLine)
Remove line range from result set
|
LineFormattingAppendable |
repeat(char c,
int count) |
LineFormattingAppendable |
repeat(CharSequence csq,
int count) |
LineFormattingAppendable |
repeat(CharSequence csq,
int start,
int end,
int count) |
LineFormattingAppendable |
setIndentPrefix(CharSequence prefix)
Set prefix to append after a new line character for every indent level
|
LineFormattingAppendable |
setOptions(int options)
Set options on processing text
|
LineFormattingAppendable |
setPrefix(CharSequence prefix,
boolean afterEol)
Set prefix appended after a new line character for every line
and after a new line in pre-formatted sections
|
int |
textOnlyOffset()
Get text offset of all output lines (not including any text not included because it is not yet terminated by line() call)
NOTE: this does not include prefixes
|
int |
textOnlyOffsetWithPending()
Get column offset after last append
NOTE: this does not include prefixes
|
String |
toString() |
String |
toString(int maxBlankLines)
get the resulting text for all lines
|
LineFormattingAppendable |
unIndent()
Decrease the indent level, min level is 0, will terminate the current line if there is unterminated text
|
LineFormattingAppendable |
unIndentNoEol()
Decrease the indent level, if there is unterminated text then unindented prefix
is to be applied after the next EOL.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddPrefix, append, append, appendTo, appendTo, appendTo, appendTo, clearLineOnFirstText, getLineContent, getLineContents, getLineContents, getLinePrefix, getLinePrefixes, getLinePrefixes, getLines, getLines, lineWithTrailingSpaces, openPreFormatted, popPrefix, prefixLines, prefixLines, prefixLines, setLineOnFirstText, setPrefixpublic LineFormattingAppendableImpl(int formatOptions)
public int getOptions()
LineFormattingAppendablegetOptions in interface LineFormattingAppendablepublic LineFormattingAppendable setOptions(int options)
LineFormattingAppendablesetOptions in interface LineFormattingAppendableoptions - option flagspublic CharSequence getIndentPrefix()
LineFormattingAppendablegetIndentPrefix in interface LineFormattingAppendablepublic LineFormattingAppendable setIndentPrefix(CharSequence prefix)
LineFormattingAppendablesetIndentPrefix in interface LineFormattingAppendableprefix - prefix characters for new lines appended after this is setpublic CharSequence getPrefix()
LineFormattingAppendablegetPrefix in interface LineFormattingAppendablepublic LineFormattingAppendable addPrefix(CharSequence prefix, boolean afterEol)
LineFormattingAppendableThis appends the sequence to current prefix
addPrefix in interface LineFormattingAppendableprefix - prefix characters to add to current prefix for new lines appended after this is setafterEol - if true prefix will take effect after EOLpublic LineFormattingAppendable setPrefix(CharSequence prefix, boolean afterEol)
LineFormattingAppendableThis appends the sequence to current prefix
setPrefix in interface LineFormattingAppendableprefix - prefix characters to add to current prefix for new lines appended after this is setafterEol - if true prefix will take effect after EOLpublic LineFormattingAppendable indent()
LineFormattingAppendable
NOTE: this is equivalent to pushPrefix(), addPrefix(getIndentPrefix()) but adds flag to
validate that LineFormattingAppendable.unIndent() is called only on prefixes added by indent()
indent in interface LineFormattingAppendablepublic LineFormattingAppendable unIndent()
LineFormattingAppendable
NOTE: this is equivalent to popPrefix() but with validation
that it is called only on prefixes added by LineFormattingAppendable.indent()
unIndent in interface LineFormattingAppendablepublic LineFormattingAppendable unIndentNoEol()
LineFormattingAppendableWill NOT terminate the current line if there is unterminated text
NOTE: should be used with LineFormattingAppendable.addIndentOnFirstEOL(Runnable) if callback is invoked
unIndentNoEol in interface LineFormattingAppendablepublic LineFormattingAppendable pushPrefix()
LineFormattingAppendablepushPrefix in interface LineFormattingAppendablepublic LineFormattingAppendable popPrefix(boolean afterEol)
LineFormattingAppendablepopPrefix in interface LineFormattingAppendableafterEol - if true prefix will take effect after EOLpublic LineFormattingAppendable append(CharSequence csq)
append in interface LineFormattingAppendableappend in interface Appendablepublic LineFormattingAppendable append(CharSequence csq, int start, int end)
append in interface LineFormattingAppendableappend in interface Appendablepublic LineFormattingAppendable append(char c)
append in interface LineFormattingAppendableappend in interface Appendablepublic LineFormattingAppendable repeat(char c, int count)
repeat in interface LineFormattingAppendablepublic LineFormattingAppendable repeat(CharSequence csq, int count)
repeat in interface LineFormattingAppendablepublic LineFormattingAppendable repeat(CharSequence csq, int start, int end, int count)
repeat in interface LineFormattingAppendablepublic boolean isPreFormattedLine(int line)
LineFormattingAppendableisPreFormattedLine in interface LineFormattingAppendableline - linepublic LineFormattingAppendable append(LineFormattingAppendable lineAppendable, int startLine, int endLine)
LineFormattingAppendableappend in interface LineFormattingAppendablelineAppendable - lines to appendstartLine - start line to appendendLine - end line to appendpublic LineFormattingAppendable prefixLines(CharSequence prefix, boolean addAfterLinePrefix, int startLine, int endLine)
LineFormattingAppendableprefixLines in interface LineFormattingAppendableprefix - prefix to addaddAfterLinePrefix - if true add given prefix after the line prefixstartLine - starting line offsetendLine - end line offsetpublic LineFormattingAppendable removeLines(int startLine, int endLine)
LineFormattingAppendableremoveLines in interface LineFormattingAppendablestartLine - starting line offsetendLine - end line offsetpublic String toString(int maxBlankLines)
LineFormattingAppendabletoString in interface LineFormattingAppendablemaxBlankLines - maximum blank lines to allow at end, if -1 then no trailing EOL will be generatedpublic List<CharSequence> getLineContents(int startOffset, int endOffset)
LineFormattingAppendablegetLineContents in interface LineFormattingAppendablestartOffset - starting line offsetendOffset - end line offsetpublic List<BasedSequence> getLinePrefixes(int startOffset, int endOffset)
LineFormattingAppendablegetLinePrefixes in interface LineFormattingAppendablestartOffset - starting line offsetendOffset - end line offsetpublic List<CharSequence> getLines(int startOffset, int endOffset)
LineFormattingAppendablegetLines in interface LineFormattingAppendablestartOffset - starting line offsetendOffset - end line offsetpublic LineFormattingAppendable appendTo(Appendable out, int maxBlankLines, CharSequence prefix, int startLine, int endLine) throws IOException
LineFormattingAppendableappendTo in interface LineFormattingAppendableout - appendable to output the resulting linesmaxBlankLines - maximum blank lines to allow at end, if -1 then no trailing EOL will be generatedprefix - prefix to add before each linestartLine - line from which to start outputIOException - if thrown by appendablepublic LineFormattingAppendable line()
LineFormattingAppendableline in interface LineFormattingAppendablepublic LineFormattingAppendable lineWithTrailingSpaces(int count)
LineFormattingAppendablelineWithTrailingSpaces in interface LineFormattingAppendablecount - number of trailing spaces to addpublic LineFormattingAppendable addLine()
LineFormattingAppendableaddLine in interface LineFormattingAppendablepublic LineFormattingAppendable lineIf(boolean predicate)
LineFormattingAppendablelineIf in interface LineFormattingAppendablepredicate - if true then new line will be startedpublic LineFormattingAppendable blankLine()
LineFormattingAppendableblankLine in interface LineFormattingAppendablepublic LineFormattingAppendable blankLineIf(boolean predicate)
LineFormattingAppendableblankLineIf in interface LineFormattingAppendablepredicate - when true append blank linepublic LineFormattingAppendable blankLine(int count)
LineFormattingAppendableblankLine in interface LineFormattingAppendablecount - number of blank lines to appendpublic int getLineCount()
LineFormattingAppendablegetLineCount in interface LineFormattingAppendablepublic int column()
LineFormattingAppendablecolumn in interface LineFormattingAppendablepublic int offset()
LineFormattingAppendableoffset in interface LineFormattingAppendablepublic int offsetWithPending()
LineFormattingAppendableoffsetWithPending in interface LineFormattingAppendableLineFormattingAppendable.offset() after line() call less 1 for EOLpublic int textOnlyOffset()
LineFormattingAppendabletextOnlyOffset in interface LineFormattingAppendablepublic int textOnlyOffsetWithPending()
LineFormattingAppendabletextOnlyOffsetWithPending in interface LineFormattingAppendableLineFormattingAppendable.offset() after line() call less 1 for EOLpublic boolean isPendingSpace()
LineFormattingAppendableisPendingSpace in interface LineFormattingAppendablepublic int getPendingSpace()
LineFormattingAppendablegetPendingSpace in interface LineFormattingAppendablepublic int getPendingEOL()
LineFormattingAppendablegetPendingEOL in interface LineFormattingAppendablepublic boolean isPreFormatted()
isPreFormatted in interface LineFormattingAppendablepublic LineFormattingAppendable openPreFormatted(boolean addPrefixToFirstLine)
LineFormattingAppendableopenPreFormatted in interface LineFormattingAppendableaddPrefixToFirstLine - if true will add current prefix to first linepublic LineFormattingAppendable closePreFormatted()
LineFormattingAppendableclosePreFormatted in interface LineFormattingAppendablepublic LineFormattingAppendable lineOnFirstText(boolean value)
lineOnFirstText in interface LineFormattingAppendablepublic LineFormattingAppendable removeIndentOnFirstEOL(Runnable runnable)
removeIndentOnFirstEOL in interface LineFormattingAppendablepublic LineFormattingAppendable addIndentOnFirstEOL(Runnable runnable)
addIndentOnFirstEOL in interface LineFormattingAppendableCopyright © 2019. All rights reserved.