Returns the size of buffer text
The number of lines in the buffer
Write a new line to the output with current indentation
The text to write as a new line
This FileBuffer instance for method chaining
Write text to the output without adding a new line
The text to write without a newline
This FileBuffer instance for method chaining
Increase indentation by 2 spaces
This FileBuffer instance for method chaining
Decrease indentation by 2 spaces (minimum of 0)
This FileBuffer instance for method chaining
Return template as a string, joining all buffer lines
Once called, the output is cached and subsequent calls return the same result. The flush method becomes a no-op after the first call.
The complete buffer content as a string
Buffer class to construct template output with proper indentation and formatting.
The FileBuffer class provides a fluent API for building text output with automatic indentation management. It's commonly used for generating code or template files where proper formatting is important.
Example