Constructors

Methods

  • 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.

    Parameters

    • format: string

      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.

    Returns PrintWriter

    This writer

    Throws

    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.

    Throws

    NullPointerException If the format is null

    Since

    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.

    Parameters

    • l: Locale

      The java.util.Locale locale to apply during formatting. If l is null then no localization is applied.

    • format: string

      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.

    Returns PrintWriter

    This writer

    Throws

    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.

    Throws

    NullPointerException If the format is null

    Since

    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.

    Parameters

    • b: boolean

      The boolean to be printed

    Returns void

  • 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.

    Parameters

    • c: string

      The char to be printed

    Returns void

  • 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.

    Parameters

    • i: number

      The int to be printed

    Returns void

    See

    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.

    Parameters

    • s: string[]

      The array of chars to be printed

    Returns void

    Throws

    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.

    Parameters

    • obj: any

      The Object to be printed

    Returns void

    See

    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)}

    Parameters

    • format: string

      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.

    Returns PrintWriter

    This writer

    Throws

    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.

    Throws

    NullPointerException If the format is null

    Since

    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)}

    Parameters

    • l: Locale

      The java.util.Locale locale to apply during formatting. If l is null then no localization is applied.

    • format: string

      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.

    Returns PrintWriter

    This writer

    Throws

    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.

    Throws

    NullPointerException If the format is null

    Since

    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').

    Returns void

  • Prints a boolean value and then terminates the line. This method behaves as though it invokes #print(boolean) and then #println().

    Parameters

    • x: boolean

      the boolean value to be printed

    Returns void

  • Prints a character and then terminates the line. This method behaves as though it invokes #print(char) and then #println().

    Parameters

    • x: string

      the char value to be printed

    Returns void

  • Prints an integer and then terminates the line. This method behaves as though it invokes #print(int) and then #println().

    Parameters

    • x: number

      the int value to be printed

    Returns void

  • Prints an array of characters and then terminates the line. This method behaves as though it invokes #print(char[]) and then #println().

    Parameters

    • x: string[]

      the array of char values to be printed

    Returns void

  • 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().

    Parameters

    • x: any

      The Object to be printed.

    Returns void

  • Writes a single character.

    Parameters

    • c: number

      int specifying a character to be written.

    Returns void

  • Writes A Portion of an array of characters.

    Parameters

    • buf: string[]

      Array of characters

    • off: number

      Offset from which to start writing characters

    • len: number

      Number of characters to write

    Returns void

    Throws

    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.

    Parameters

    • buf: string[]

      Array of characters to be written

    Returns void

  • Writes a portion of a string.

    Parameters

    • s: string

      A String

    • off: number

      Offset from which to start writing characters

    • len: number

      Number of characters to write

    Returns void

    Throws

    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.

    Parameters

    • s: string

      String to be written

    Returns void