Package com.igormaznitsa.jbbp.utils
Class JavaSrcTextBuffer
java.lang.Object
com.igormaznitsa.jbbp.utils.JavaSrcTextBuffer
Text buffer to provide text manipulation operations to form Java style sources.
- Since:
- 1.3.0
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor with default capacity.JavaSrcTextBuffer(int capacity) Constructor with capacity value. -
Method Summary
Modifier and TypeMethodDescriptionclean()Clean bufferDecrease indentIncrease indentindent()Print tabs for current indent numberbooleanisEmpty()Check that the buffer is emptyprint(boolean value) Print boolean valueprint(int value) Print integer valuePrint stringParse string to lines and print each line with '//' commentPrint string as multiline java comment started with '/*'Formatted print.Print string as multiline java comment started with '/**'printLinesWithIndent(String text) Parse string to lines and print each line with current indentprintln()Print next line charPrint text and next line char in the endtab()Print tab chartoString()
-
Constructor Details
-
JavaSrcTextBuffer
public JavaSrcTextBuffer()Constructor with default capacity. -
JavaSrcTextBuffer
public JavaSrcTextBuffer(int capacity) Constructor with capacity value.- Parameters:
capacity- capacity of the created buffer
-
-
Method Details
-
incIndent
Increase indent- Returns:
- this instance
-
decIndent
Decrease indent- Returns:
- this instance
-
print
Print integer value- Parameters:
value- integer value- Returns:
- this instance
-
print
Print boolean value- Parameters:
value- boolean value- Returns:
- this instance
-
printf
Formatted print.- Parameters:
text- format stringargs- arguments for formatted string- Returns:
- this instance
- See Also:
-
print
Print string- Parameters:
text- string- Returns:
- this instance
-
clean
Clean buffer- Returns:
- this instance
-
tab
Print tab char- Returns:
- this instance
-
indent
Print tabs for current indent number- Returns:
- this instance
-
println
Print next line char- Returns:
- this instance
-
isEmpty
public boolean isEmpty()Check that the buffer is empty- Returns:
- true if the buffer is empty, false otherwise
-
println
Print text and next line char in the end- Parameters:
text- the text to be printed- Returns:
- this instance
-
printLinesWithIndent
Parse string to lines and print each line with current indent- Parameters:
text- the text to be printed- Returns:
- this instance
-
printCommentLinesWithIndent
Parse string to lines and print each line with '//' comment- Parameters:
text- text to be printed- Returns:
- this instance
-
printCommentMultiLinesWithIndent
Print string as multiline java comment started with '/*'- Parameters:
text- text to be printed as multiline comment- Returns:
- this instance
-
printJavaDocLinesWithIndent
Print string as multiline java comment started with '/**'- Parameters:
text- text to be printed as multiline comment- Returns:
- this instance
-
toString
-