public class PrintfWriter extends PrintWriter
Because Java does not permit variable numbers of arguments, each printf methodName accepts only one primitive type, and the formats can correspondingly contain only one conversion sequence.
PrintfFormat
,
PrintfStream
out
Constructor and Description |
---|
PrintfWriter(OutputStream pout)
Creates a PrintfWriter, without automatic line flushing,
from an existing OutputStream.
|
PrintfWriter(OutputStream pout,
boolean autoFlush)
Creates a PrintfWriter from an existing OutputStream.
|
PrintfWriter(Writer pout)
Creates a PrintfWriter, without automatic line flushing,
from an existing Writer.
|
PrintfWriter(Writer pout,
boolean autoFlush)
Creates a PrintfWriter from an existing Writer.
|
Modifier and Type | Method and Description |
---|---|
void |
printf(PrintfFormat fmt,
char x)
Prints a char in accordance with the supplied
PrintfFormat object.
|
void |
printf(PrintfFormat fmt,
double x)
Prints a double in accordance with the supplied
PrintfFormat object.
|
void |
printf(PrintfFormat fmt,
float x)
Prints a float in accordance with the supplied
PrintfFormat object.
|
void |
printf(PrintfFormat fmt,
int x)
Prints an int in accordance with the supplied
PrintfFormat object.
|
void |
printf(PrintfFormat fmt,
long x)
Prints a long in accordance with the supplied
PrintfFormat object.
|
void |
printf(PrintfFormat fmt,
String x)
Prints a String in accordance with the supplied
PrintfFormat object.
|
void |
printf(String fs,
char x)
Prints a char in accordance with the supplied format string.
|
void |
printf(String fs,
double x)
Prints a double in accordance with the supplied format string.
|
void |
printf(String fs,
float x)
Prints a float in accordance with the supplied format string.
|
void |
printf(String fs,
int x)
Prints an int in accordance with the supplied format string.
|
void |
printf(String fs,
long x)
Prints a long in accordance with the supplied format string.
|
void |
printf(String fs,
String x)
Prints a String in accordance with the supplied format string.
|
append, append, append, checkError, clearError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError, write, write, write, write, write
public PrintfWriter(OutputStream pout)
out
- An output streampublic PrintfWriter(Writer pout)
out
- A writerpublic PrintfWriter(OutputStream pout, boolean autoFlush)
out
- An output streamautoFlush
- If true, specifies that output flushing will
automatically occur when the println() methods are called.public PrintfWriter(Writer pout, boolean autoFlush)
out
- A writerautoFlush
- If true, specifies that output flushing will
automatically occur when the println() methods are called.public void printf(String fs, double x)
fs
- Format stringx
- Double to outputIllegalArgumentException
- Malformed format stringpublic void printf(String fs, float x)
fs
- Format stringx
- Float to outputIllegalArgumentException
- Malformed format stringpublic void printf(String fs, long x)
fs
- Format stringx
- Long to outputIllegalArgumentException
- Malformed format stringpublic void printf(String fs, int x)
fs
- Format stringx
- Int to outputIllegalArgumentException
- Malformed format stringpublic void printf(String fs, String x)
fs
- Format stringx
- String to outputIllegalArgumentException
- Malformed format stringpublic void printf(String fs, char x)
fs
- Format stringx
- Char to outputIllegalArgumentException
- Malformed format stringpublic void printf(PrintfFormat fmt, double x)
fmt
- Formatting objectx
- Double to outputPrintfFormat
public void printf(PrintfFormat fmt, float x)
fmt
- Formatting objectx
- Float to outputPrintfFormat
public void printf(PrintfFormat fmt, long x)
fmt
- Formatting objectx
- Long to outputPrintfFormat
public void printf(PrintfFormat fmt, int x)
fmt
- Formatting objectx
- Int to outputPrintfFormat
public void printf(PrintfFormat fmt, String x)
fmt
- Formatting objectx
- String to outputPrintfFormat
public void printf(PrintfFormat fmt, char x)
fmt
- Formatting objectx
- Char to outputPrintfFormat
Copyright © 2018. All rights reserved.