Writes a formatted string to this writer using the specified format string and arguments. If automatic flushing is enabled, calls to this method will flush the output buffer.
The locale always used is the one returned by java.util.Locale#getDefault() Locale.getDefault(), regardless of any previous invocations of other formatting methods on this object.
A format string as described in Format string syntax.
Rest
...args: any[]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 maximum number of arguments is
limited by the maximum dimension of a Java array as defined by
The Java™ Virtual Machine Specification.
The behaviour on a
null
argument depends on the conversion.
This writer
java.util.IllegalFormatException If a format string 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 the Formatter class specification.
NullPointerException
If the format
is null
1.5
Writes a formatted string to this writer using the specified format string and arguments. If automatic flushing is enabled, calls to this method will flush the output buffer.
The java.util.Locale locale to apply during
formatting. If l
is null
then no localization
is applied.
A format string as described in Format string syntax.
Rest
...args: any[]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 maximum number of arguments is
limited by the maximum dimension of a Java array as defined by
The Java™ Virtual Machine Specification.
The behaviour on a
null
argument depends on the conversion.
This writer
java.util.IllegalFormatException If a format string 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 the formatter class specification.
NullPointerException
If the format
is null
1.5
Prints a boolean value. The string produced by java.lang.String#valueOf(boolean) is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the #write(int) method.
The boolean
to be printed
Prints a character. The character is translated into one or more bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the #write(int) method.
The char
to be printed
Prints an integer. The string produced by java.lang.String#valueOf(int) is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the #write(int) method.
The int
to be printed
java.lang.Integer#toString(int)
Prints an array of characters. The characters are converted into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the #write(int) method.
The array of chars to be printed
NullPointerException If s
is null
Prints an object. The string produced by the java.lang.String#valueOf(Object) method is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the #write(int) method.
The Object
to be printed
java.lang.Object#toString()
A convenience method to write a formatted string to this writer using the specified format string and arguments. If automatic flushing is enabled, calls to this method will flush the output buffer.
An invocation of this method of the form
out.printf(format, args)
behaves in exactly the same way as the invocation
{@code out.format(format, args)}
A format string as described in Format string syntax.
Rest
...args: any[]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 maximum number of arguments is
limited by the maximum dimension of a Java array as defined by
The Java™ Virtual Machine Specification.
The behaviour on a
null
argument depends on the conversion.
This writer
java.util.IllegalFormatException If a format string 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 the formatter class specification.
NullPointerException
If the format
is null
1.5
A convenience method to write a formatted string to this writer using the specified format string and arguments. If automatic flushing is enabled, calls to this method will flush the output buffer.
An invocation of this method of the form
out.printf(l, format, args)
behaves in exactly the same way as the invocation
{@code out.format(l, format, args)}
The java.util.Locale locale to apply during
formatting. If l
is null
then no localization
is applied.
A format string as described in Format string syntax.
Rest
...args: any[]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 maximum number of arguments is
limited by the maximum dimension of a Java array as defined by
The Java™ Virtual Machine Specification.
The behaviour on a
null
argument depends on the conversion.
This writer
java.util.IllegalFormatException If a format string 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 the formatter class specification.
NullPointerException
If the format
is null
1.5
Terminates the current line by writing the line separator string. The
line separator string is defined by the system property
line.separator
, and is not necessarily a single newline
character ('\n'
).
Prints a boolean value and then terminates the line. This method behaves as though it invokes #print(boolean) and then #println().
the boolean
value to be printed
Prints a character and then terminates the line. This method behaves as though it invokes #print(char) and then #println().
the char
value to be printed
Prints an integer and then terminates the line. This method behaves as though it invokes #print(int) and then #println().
the int
value to be printed
Prints an array of characters and then terminates the line. This method behaves as though it invokes #print(char[]) and then #println().
the array of char
values to be printed
Prints an Object and then terminates the line. This method calls at first String.valueOf(x) to get the printed object's string value, then behaves as though it invokes #print(String) and then #println().
The Object
to be printed.
Writes a single character.
int specifying a character to be written.
Writes A Portion of an array of characters.
Array of characters
Offset from which to start writing characters
Number of characters to write
IndexOutOfBoundsException
If the values of the off
and len
parameters
cause the corresponding method of the underlying Writer
to throw an IndexOutOfBoundsException
Writes an array of characters. This method cannot be inherited from the Writer class because it must suppress I/O exceptions.
Array of characters to be written
Writes a portion of a string.
A String
Offset from which to start writing characters
Number of characters to write
IndexOutOfBoundsException
If the values of the off
and len
parameters
cause the corresponding method of the underlying Writer
to throw an IndexOutOfBoundsException
Writes a string. This method cannot be inherited from the Writer class because it must suppress I/O exceptions.
String to be written
Flushes the stream.