Class TextBuffer
- java.lang.Object
-
- org.jetbrains.java.decompiler.util.TextBuffer
-
public class TextBuffer extends java.lang.ObjectAllows to connect text with resulting lines
-
-
Constructor Summary
Constructors Constructor Description TextBuffer()TextBuffer(int size)TextBuffer(java.lang.String text)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBytecodeMapping(int bytecodeOffset)voidaddBytecodeMapping(java.util.BitSet bytecodeOffsets)voidaddStartBytecodeMapping(int bytecodeOffset)voidaddStartBytecodeMapping(java.util.BitSet bytecodeOffsets)TextBufferappend(char ch)TextBufferappend(int i)TextBufferappend(java.lang.String str)TextBufferappend(TextBuffer buffer)TextBufferappend(TextBuffer buffer, java.lang.String className, java.lang.String methodKey)TextBufferappendIndent(int length)TextBufferappendLineSeparator()TextBufferappendPossibleNewline()If the current group is applied, add a newline here.TextBufferappendPossibleNewline(java.lang.String alternative)If the current group is applied, add a newline here.TextBufferappendPossibleNewline(java.lang.String alternative, boolean dedent)If the current group is applied, add a newline here.static voidcheckLeaks()voidclearUnassignedBytecodeMappingData()booleancontainsOnlyWhitespaces()booleancontentEquals(java.lang.String string)java.lang.StringconvertToStringAndAllowDataDiscard()intcount(java.lang.String substring, int from)intcountLines()intcountLines(int from)voiddumpOriginalLineNumbers(int[] lineMapping)TextBufferenclose(java.lang.String left, java.lang.String right)java.util.Map<Pair<java.lang.String,java.lang.String>,BytecodeMappingTracer>getTracers()intlength()TextBufferpopNewlineGroup()TextBufferprepend(java.lang.String s)TextBufferpushNewlineGroup(int baseIndent, int extraIndent)Pushes a newline group.voidreformat()voidsetLength(int position)voidsetStart(int position)java.lang.StringtoString()
-
-
-
Method Detail
-
append
public TextBuffer append(java.lang.String str)
-
append
public TextBuffer append(char ch)
-
append
public TextBuffer append(int i)
-
appendLineSeparator
public TextBuffer appendLineSeparator()
-
appendIndent
public TextBuffer appendIndent(int length)
-
pushNewlineGroup
public TextBuffer pushNewlineGroup(int baseIndent, int extraIndent)
Pushes a newline group.appendPossibleNewline()normally works like append, adding its string argument to the buffer. However, if the line is running out of space, this text may later be replaced with a newline (plus indents). Possible newlines are grouped into newline groups. In a newline group, either none of the replacements are replaced with newlines, or all of them are (never only some of them). Possible newlines should not be added outside a group. The API works as if there were a stack of newline groups. This method pushes to the stack andpopNewlineGroup()pops from it. After the full source code has been generated,reformat()is called to actually substitute the text.- Parameters:
baseIndent- The indent that has already been explicitly appliedextraIndent- The indent to be added if this group is applied
-
appendPossibleNewline
public TextBuffer appendPossibleNewline()
If the current group is applied, add a newline here.
-
appendPossibleNewline
public TextBuffer appendPossibleNewline(java.lang.String alternative)
If the current group is applied, add a newline here. Otherwise, add the argument.
-
appendPossibleNewline
public TextBuffer appendPossibleNewline(java.lang.String alternative, boolean dedent)
If the current group is applied, add a newline here. Otherwise, add the argument. Ifdedentis true, the extra indent from this group is unapplied from this point on.
-
popNewlineGroup
public TextBuffer popNewlineGroup()
-
prepend
public TextBuffer prepend(java.lang.String s)
-
enclose
public TextBuffer enclose(java.lang.String left, java.lang.String right)
-
containsOnlyWhitespaces
public boolean containsOnlyWhitespaces()
-
addBytecodeMapping
public void addBytecodeMapping(int bytecodeOffset)
-
addStartBytecodeMapping
public void addStartBytecodeMapping(int bytecodeOffset)
-
addBytecodeMapping
public void addBytecodeMapping(java.util.BitSet bytecodeOffsets)
-
addStartBytecodeMapping
public void addStartBytecodeMapping(java.util.BitSet bytecodeOffsets)
-
clearUnassignedBytecodeMappingData
public void clearUnassignedBytecodeMappingData()
-
getTracers
public java.util.Map<Pair<java.lang.String,java.lang.String>,BytecodeMappingTracer> getTracers()
-
reformat
public void reformat()
-
contentEquals
public boolean contentEquals(java.lang.String string)
-
convertToStringAndAllowDataDiscard
public java.lang.String convertToStringAndAllowDataDiscard()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
length
public int length()
-
setStart
public void setStart(int position)
-
setLength
public void setLength(int position)
-
append
public TextBuffer append(TextBuffer buffer, java.lang.String className, java.lang.String methodKey)
-
append
public TextBuffer append(TextBuffer buffer)
-
countLines
public int countLines()
-
countLines
public int countLines(int from)
-
count
public int count(java.lang.String substring, int from)
-
dumpOriginalLineNumbers
public void dumpOriginalLineNumbers(int[] lineMapping)
-
checkLeaks
public static void checkLeaks()
-
-