- All Superinterfaces:
Appendable
- All Known Implementing Classes:
BufferSimpleWriter,DefaultSimpleWriter
A simple writer interface.
Similar to a subset from Writer, but with newLine() method
added, similar to BufferedWriter.newLine() but with the difference that
the newline not necessarily uses the line.separator system property and
instead may target another system.
-
Method Summary
Modifier and TypeMethodDescriptiondefault SimpleWriterappend(char c) default SimpleWriterappend(CharSequence csq) default SimpleWriterappend(CharSequence csq, int start, int end) default charGet the last character processed.voidnewLine()Write a newline according to the characteristics of the target platform.default voidunwrite()Remove the last character found in this buffer, if any.default voidunwrite(int numChars) Remove the lastnumCharscharacters found in this buffer.voidwrite(char c) Write a character.voidwrite(char[] cbuf, int off, int len) Write a sequence of characters from an array.default voidwrite(int num) Write an integer.voidwrite(CharSequence seq) Write a character sequence.
-
Method Details
-
newLine
Write a newline according to the characteristics of the target platform.- Throws:
IOException- if an error happens when writing.
-
write
Write a character sequence.- Parameters:
seq- the CharSequence.- Throws:
IOException- if an error happens when writing.
-
append
- Specified by:
appendin interfaceAppendable- Throws:
IOException
-
append
- Specified by:
appendin interfaceAppendable- Throws:
IOException
-
write
Write a sequence of characters from an array.- Parameters:
cbuf- the character array.off- the offset to start writing.len- the number of characters to write from the array.- Throws:
IOException- if an error happens when writing.
-
write
Write a character.- Parameters:
c- the character.- Throws:
IOException- if an error happens when writing.
-
append
- Specified by:
appendin interfaceAppendable- Throws:
IOException
-
write
Write an integer.- Parameters:
num- the integer number.- Throws:
IOException- if an error happens when writing.
-
unwrite
Remove the last character found in this buffer, if any.Optional operation.
- Throws:
UnsupportedOperationException- if the operation is not supported.
-
unwrite
Remove the lastnumCharscharacters found in this buffer.If
numCharsis larger than the length of this buffer, removes all its contents.- Parameters:
numChars- the number of characters to remove.- Throws:
UnsupportedOperationException- if the operation is not supported.
-
getLastChar
Get the last character processed.Optional operation.
- Returns:
- the last character processed.
- Throws:
UnsupportedOperationException- if the operation is not supported.IllegalStateException- if no character was processed yet.
-