Package org.svetovid.io
Interface SvetovidWriter
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
AbstractSvetovidWriter,DefaultSvetovidWriter,StandardSvetovidErrorWriter,StandardSvetovidWriter
This interface provides methods that simplify outputting data for beginner
programmers. Exception handling is not necessary as it can be turned on or
off by using
setThrowingExceptions(boolean). Even when the exception
throwing is turned off, if necessary, the last raised exception can be
retrieved using getLastException() method.-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this writer and releases any resources associated with the underlying stream.booleanReturns whether this writer automatically flushes the underlying output stream and forces any buffered output bytes to be written out after every operation by callingprintbf().Returns the exception raised in the last operation; if the operation was successful and no exception was raised, returnsnull.Returns the currently used whitespace.booleanReturns the indicator whether this writer will throw exceptions on I/O operation errors or just return default values.voidprint()Prints a whitespace.voidprint(boolean value) Prints a boolean value as a human readable string.voidprint(byte value) Prints a byte value as a human readable string.voidprint(char value) Prints a character value as a human readable string.voidprint(double value) Prints a double-precision floating-point value as a human readable string.voidprint(float value) Prints a floating-point value as a human readable string.voidprint(int value) Prints an integer value as a human readable string.voidprint(long value) Prints a long integer value as a human readable string.voidprint(short value) Prints a short integer value as a human readable string.voidPrints an object as a human readable string.voidPrints a string.voidprintbf()Prints any buffered data to the underlying output stream and then flushes that stream.voidPrints a formatted string using the specified format string and arguments.voidprintln()Prints a line separator as defined by theline.separatorsystem property.voidprintln(boolean value) Prints a boolean value and then terminates the line.voidprintln(boolean... values) Prints all given boolean values in sequence separated by whitespace and then terminates the line.voidprintln(boolean[][] value) Prints the given boolean matrix row by row, each in the separate line, with the individual elements separated by whitespace.voidprintln(byte value) Prints a byte value and then terminates the line.voidprintln(byte... values) Prints all given byte values in sequence separated by whitespace and then terminates the line.voidprintln(byte[][] value) Prints the given byte matrix row by row, each in the separate line, with the individual elements separated by whitespace.voidprintln(char value) Prints a character value and then terminates the line.voidprintln(char... values) Prints all given character values in sequence separated by whitespace and then terminates the line.voidprintln(char[][] value) Prints the given character matrix row by row, each in the separate line, with the individual elements separated by whitespace.voidprintln(double value) Prints a double-precision floating-point value and then terminates the line.voidprintln(double... values) Prints all given double-precision floating-point values in sequence separated by whitespace and then terminates the line.voidprintln(double[][] value) Prints the given double-precision floating-point matrix row by row, each in the separate line, with the individual elements separated by whitespace.voidprintln(float value) Prints a floating-point value and then terminates the line.voidprintln(float... values) Prints all given floating-point values in sequence separated by whitespace and then terminates the line.voidprintln(float[][] value) Prints the given floating-point matrix row by row, each in the separate line, with the individual elements separated by whitespace.voidprintln(int value) Prints an integer value and then terminates the line.voidprintln(int... values) Prints all given integer values in sequence separated by whitespace and then terminates the line.voidprintln(int[][] value) Prints the given integer matrix row by row, each in the separate line, with the individual elements separated by whitespace.voidprintln(long value) Prints a long integer value and then terminates the line.voidprintln(long... values) Prints all given long integer values in sequence separated by whitespace and then terminates the line.voidprintln(long[][] value) Prints the given long integer matrix row by row, each in the separate line, with the individual elements separated by whitespace.voidprintln(short value) Prints a short integer value and then terminates the line.voidprintln(short... values) Prints all given short integer values in sequence separated by whitespace and then terminates the line.voidprintln(short[][] value) Prints the given short integer matrix row by row, each in the separate line, with the individual elements separated by whitespace.voidPrints all given boolean values in sequence separated by whitespace and then terminates the line.voidPrints the given boolean matrix row by row, each in the separate line, with the individual elements separated by whitespace.voidPrints all given byte values in sequence separated by whitespace and then terminates the line.voidPrints the given byte matrix row by row, each in the separate line, with the individual elements separated by whitespace.voidPrints all given character values in sequence separated by whitespace and then terminates the line.voidPrints the given character matrix row by row, each in the separate line, with the individual elements separated by whitespace.voidPrints all given double-precision floating-point values in sequence separated by whitespace and then terminates the line.voidPrints the given double-precision floating-point matrix row by row, each in the separate line, with the individual elements separated by whitespace.voidPrints all given floating-point values in sequence separated by whitespace and then terminates the line.voidPrints the given floating-point matrix row by row, each in the separate line, with the individual elements separated by whitespace.voidPrints all given integer values in sequence separated by whitespace and then terminates the line.voidPrints the given integer matrix row by row, each in the separate line, with the individual elements separated by whitespace.voidPrints all given long integer values in sequence separated by whitespace and then terminates the line.voidPrints the given long integer matrix row by row, each in the separate line, with the individual elements separated by whitespace.voidPrints an object and then terminates the line.voidPrints all given objects in sequence separated by whitespace and then terminates the line.voidPrints the given object matrix row by row, each in the separate line, with the individual elements separated by whitespace.voidPrints all given short integer values in sequence separated by whitespace and then terminates the line.voidPrints the given short integer matrix row by row, each in the separate line, with the individual elements separated by whitespace.voidPrints a string and then terminates the line.voidPrints all given string values in sequence separated by whitespace and then terminates the line.voidPrints the given string matrix row by row, each in the separate line, with the individual elements separated by whitespace.voidprintObject(Object value) Prints the given object in JSON (JavaScript Object Notation) format.voidsetAutoFlush(boolean autoFlush) Configures whether this writer should automatically flush the underlying output stream and force any buffered output bytes to be written out after every operation by callingprintbf().voidsetThrowingExceptions(boolean shouldThrow) Configures whether this writer should throw exceptions on I/O operation errors or just return default values.voidsetWhitespace(String whitespace) Sets the string used as whitespace.
-
Method Details
-
getWhitespace
String getWhitespace()Returns the currently used whitespace. This whitespace is written by methods likeprint()andprintln(Object[]).- Returns:
- the string currently used as whitespace.
-
setWhitespace
Sets the string used as whitespace. This whitespace is written by methods likeprint()andprintln(Object[]).- Parameters:
whitespace- the string to use as whitespace
-
getAutoFlush
boolean getAutoFlush()Returns whether this writer automatically flushes the underlying output stream and forces any buffered output bytes to be written out after every operation by callingprintbf().- Returns:
trueif this writer automatically flushes the underlying output stream;falseotherwise.
-
setAutoFlush
void setAutoFlush(boolean autoFlush) Configures whether this writer should automatically flush the underlying output stream and force any buffered output bytes to be written out after every operation by callingprintbf().- Parameters:
autoFlush- iftruethis writer will callprintbf()after every operation
-
isThrowingExceptions
boolean isThrowingExceptions()Returns the indicator whether this writer will throw exceptions on I/O operation errors or just return default values.- Returns:
trueif this writer throws exceptions on failed I/O operations;falseotherwise.
-
setThrowingExceptions
void setThrowingExceptions(boolean shouldThrow) Configures whether this writer should throw exceptions on I/O operation errors or just return default values.- Parameters:
shouldThrow-trueif this writer should throw exceptions on failed I/O operations in the future;falseif it should return default values.
-
getLastException
Throwable getLastException()Returns the exception raised in the last operation; if the operation was successful and no exception was raised, returnsnull.- Returns:
- the exception raised in the last operation or
nullit the operation was successful.
-
close
Closes this writer and releases any resources associated with the underlying stream. The general contract ofcloseis that it closes the output stream. A closed stream cannot perform output operations and cannot be reopened.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
SvetovidIOException- if an error occurred during the operation.
-
print
Prints a boolean value as a human readable string.- Parameters:
value- Thebooleanvalue to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
print
Prints a byte value as a human readable string.- Parameters:
value- Thebytevalue to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
print
Prints a short integer value as a human readable string.- Parameters:
value- Theshortvalue to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
print
Prints an integer value as a human readable string.- Parameters:
value- Theintegervalue to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
print
Prints a long integer value as a human readable string.- Parameters:
value- Thelongvalue to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
print
Prints a floating-point value as a human readable string.- Parameters:
value- Thefloatvalue to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
print
Prints a double-precision floating-point value as a human readable string.- Parameters:
value- Thedoublevalue to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
print
Prints a character value as a human readable string.- Parameters:
value- Thecharactervalue to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
print
Prints a string. If the argument isnullthen the string"null"is printed.- Parameters:
value- TheStringvalue to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
print
Prints an object as a human readable string.- Parameters:
value- TheObjectto be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
print
Prints a whitespace.- Throws:
SvetovidIOException- if an error occurred during the operation.
-
printbf
Prints any buffered data to the underlying output stream and then flushes that stream.- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints a boolean value and then terminates the line. This method behaves as though it invokesprint(boolean)and thenprintln().- Parameters:
value- Thebooleanvalue to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints a byte value and then terminates the line. This method behaves as though it invokesprint(byte)and thenprintln().- Parameters:
value- Thebytevalue to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints a short integer value and then terminates the line. This method behaves as though it invokesprint(short)and thenprintln().- Parameters:
value- Theshortvalue to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints an integer value and then terminates the line. This method behaves as though it invokesprint(int)and thenprintln().- Parameters:
value- Theintegervalue to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints a long integer value and then terminates the line. This method behaves as though it invokesprint(long)and thenprintln().- Parameters:
value- Thelongvalue to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints a floating-point value and then terminates the line. This method behaves as though it invokesprint(float)and thenprintln().println().- Parameters:
value- Thefloatvalue to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints a double-precision floating-point value and then terminates the line. This method behaves as though it invokesprint(double)and thenprintln().- Parameters:
value- Thedoublevalue to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints a character value and then terminates the line. This method behaves as though it invokesprint(char)and thenprintln().- Parameters:
value- Thecharactervalue to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints a string and then terminates the line. This method behaves as though it invokesprint(String)and thenprintln().- Parameters:
value- TheStringvalue to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints an object and then terminates the line. This method behaves as though it invokesprint(Object)and thenprintln().- Parameters:
value- TheObjectto be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints a line separator as defined by theline.separatorsystem property.- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints all given boolean values in sequence separated by whitespace and then terminates the line. This method behaves as though it invokesprint(boolean)for each of the given values invokingprint()in-between andprintln()at the end.- Parameters:
values- Thebooleanvalues to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints all given byte values in sequence separated by whitespace and then terminates the line. This method behaves as though it invokesprint(byte)for each of the given values invokingprint()in-between andprintln()at the end.- Parameters:
values- Thebytevalues to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints all given short integer values in sequence separated by whitespace and then terminates the line. This method behaves as though it invokesprint(short)for each of the given values invokingprint()in-between andprintln()at the end.- Parameters:
values- Theshortvalues to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints all given integer values in sequence separated by whitespace and then terminates the line. This method behaves as though it invokesprint(int)for each of the given values invokingprint()in-between andprintln()at the end.- Parameters:
values- Theintvalues to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints all given long integer values in sequence separated by whitespace and then terminates the line. This method behaves as though it invokesprint(long)for each of the given values invokingprint()in-between andprintln()at the end.- Parameters:
values- Thelongvalues to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints all given floating-point values in sequence separated by whitespace and then terminates the line. This method behaves as though it invokesprint(float)for each of the given values invokingprint()in-between andprintln()at the end.- Parameters:
values- Thefloatvalues to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints all given double-precision floating-point values in sequence separated by whitespace and then terminates the line. This method behaves as though it invokesprint(double)for each of the given values invokingprint()in-between andprintln()at the end.- Parameters:
values- Thedoublevalues to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints all given character values in sequence separated by whitespace and then terminates the line. This method behaves as though it invokesprint(char)for each of the given values invokingprint()in-between andprintln()at the end.- Parameters:
values- Thecharvalues to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints all given boolean values in sequence separated by whitespace and then terminates the line. This method behaves as though it invokesprintln(Object[]).- Parameters:
values- TheBooleanvalues to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints all given byte values in sequence separated by whitespace and then terminates the line. This method behaves as though it invokesprintln(Object[]).- Parameters:
values- TheBytevalues to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints all given short integer values in sequence separated by whitespace and then terminates the line. This method behaves as though it invokesprintln(Object[]).- Parameters:
values- TheShortvalues to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints all given integer values in sequence separated by whitespace and then terminates the line. This method behaves as though it invokesprintln(Object[]).- Parameters:
values- TheIntegervalues to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints all given long integer values in sequence separated by whitespace and then terminates the line. This method behaves as though it invokesprintln(Object[]).- Parameters:
values- TheLongvalues to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints all given floating-point values in sequence separated by whitespace and then terminates the line. This method behaves as though it invokesprintln(Object[]).- Parameters:
values- TheFloatvalues to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints all given double-precision floating-point values in sequence separated by whitespace and then terminates the line. This method behaves as though it invokesprintln(Object[]).- Parameters:
values- TheDoublevalues to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints all given character values in sequence separated by whitespace and then terminates the line. This method behaves as though it invokesprintln(Object[]).- Parameters:
values- TheCharactervalues to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints all given string values in sequence separated by whitespace and then terminates the line. This method behaves as though it invokesprint(String)for each of the given values invokingprint()in-between andprintln()at the end.- Parameters:
values- TheStringvalues to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints all given objects in sequence separated by whitespace and then terminates the line. This method behaves as though it invokesprint(Object)for each of the given values invokingprint()in-between andprintln()at the end.- Parameters:
values- TheObjectvalues to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints the given boolean matrix row by row, each in the separate line, with the individual elements separated by whitespace.- Parameters:
value- Thebooleanmatrix to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints the given byte matrix row by row, each in the separate line, with the individual elements separated by whitespace.- Parameters:
value- Thebytematrix to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints the given short integer matrix row by row, each in the separate line, with the individual elements separated by whitespace.- Parameters:
value- Theshortmatrix to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints the given integer matrix row by row, each in the separate line, with the individual elements separated by whitespace.- Parameters:
value- Theintmatrix to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints the given long integer matrix row by row, each in the separate line, with the individual elements separated by whitespace.- Parameters:
value- Thelongmatrix to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints the given floating-point matrix row by row, each in the separate line, with the individual elements separated by whitespace.- Parameters:
value- Thefloatmatrix to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints the given double-precision floating-point matrix row by row, each in the separate line, with the individual elements separated by whitespace.- Parameters:
value- Thedoublematrix to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints the given character matrix row by row, each in the separate line, with the individual elements separated by whitespace.- Parameters:
value- Thecharmatrix to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints the given boolean matrix row by row, each in the separate line, with the individual elements separated by whitespace.- Parameters:
value- TheBooleanmatrix to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints the given byte matrix row by row, each in the separate line, with the individual elements separated by whitespace.- Parameters:
value- TheBytematrix to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints the given short integer matrix row by row, each in the separate line, with the individual elements separated by whitespace.- Parameters:
value- TheShortmatrix to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints the given integer matrix row by row, each in the separate line, with the individual elements separated by whitespace.- Parameters:
value- TheIntegermatrix to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints the given long integer matrix row by row, each in the separate line, with the individual elements separated by whitespace.- Parameters:
value- TheLongmatrix to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints the given floating-point matrix row by row, each in the separate line, with the individual elements separated by whitespace.- Parameters:
value- TheFloatmatrix to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints the given double-precision floating-point matrix row by row, each in the separate line, with the individual elements separated by whitespace.- Parameters:
value- TheDoublematrix to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints the given character matrix row by row, each in the separate line, with the individual elements separated by whitespace.- Parameters:
value- TheCharactermatrix to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints the given string matrix row by row, each in the separate line, with the individual elements separated by whitespace.- Parameters:
value- TheStringmatrix to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
println
Prints the given object matrix row by row, each in the separate line, with the individual elements separated by whitespace.- Parameters:
value- TheObjectmatrix to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-
printf
Prints a formatted string using the specified format string and arguments. For details seeFormatter.- Parameters:
format- A format string as described inFormatterstring syntax.arguments- Arguments referenced by the format specifiers in the format string. If there are more arguments than format specifiers, the extra arguments are ignored. The number of arguments is variable and may be zero. The behavior on a null argument depends on the conversion.- Throws:
SvetovidFormatException- If a format string isnull, contains an illegal syntax, a format specifier that is incompatible with the given arguments, insufficient arguments given the format string, or other illegal conditions. For specification of all possible formatting errors, see the Details section of theFormatterclass specification.SvetovidIOException- if an error occurred during the operation.
-
printObject
Prints the given object in JSON (JavaScript Object Notation) format.The object is printed using the following rules:
nullis printed as JSONnullliteral,- Boxed
trueandfalsevalues are printed as JSON literalstrueandfalserespectively, Numberinstances are printed as JSON number literals,Stringvalues are printed as JSON string literals,- arrays and all
Iterables are printed as JSON arrays maintaining iteration order, Maps are printed as JSON objects with each entry representing one member; map entries are printed in iteration order with the entry key as the member's name and entry value as the value,- All other objects are converted to strings using their {code toString()}.
- Parameters:
value- TheObjectmatrix to be written- Throws:
SvetovidIOException- if an error occurred during the operation.
-