|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.OutputStream | +--java.io.FilterOutputStream | +--java.io.PrintStream | +--cformat.PrintfStream
PrintStream which outputs primitive types using C printf
style formatting. For each primitive type (float, double, char, int, long,
String), there is a printf
method which takes (as a first
argument) either a printf
style format string, or a
PrintfFormat object.
Using the latter can be more efficient because it permits an
application to prorate the overhead of parsing a format string.
Because Java does not permit variable numbers of arguments, each
printf
function accepts only one primitive type, and the
format can correspondingly contain only one conversion
sequence.
PrintfFormat
,
PrintfWriter
Constructor Summary | |
PrintfStream(java.io.OutputStream out)
Creates a PrintfStream, without automatic line flushing, from an existing OutputStream. |
|
PrintfStream(java.io.OutputStream out,
boolean autoFlush)
Creates a PrintfStream from an existing OutputStream. |
Method Summary | |
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,
java.lang.String x)
Prints a String in accordance with the supplied PrintfFormat object. |
void |
printf(java.lang.String fs,
char x)
Prints a char in accordance with the supplied format string. |
void |
printf(java.lang.String fs,
double x)
Prints a double in accordance with the supplied format string. |
void |
printf(java.lang.String fs,
float x)
Prints a float in accordance with the supplied format string. |
void |
printf(java.lang.String fs,
int x)
Prints an int in accordance with the supplied format string. |
void |
printf(java.lang.String fs,
long x)
Prints a long in accordance with the supplied format string. |
void |
printf(java.lang.String fs,
java.lang.String x)
Prints a String in accordance with the supplied format string. |
Methods inherited from class java.io.PrintStream |
checkError, close, flush, print, print, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, println, println, write, write |
Methods inherited from class java.io.FilterOutputStream |
write |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PrintfStream(java.io.OutputStream out)
out
- An output streampublic PrintfStream(java.io.OutputStream out, boolean autoFlush)
out
- An output streamautoFlush
- If true, specifies that output flushing will
automatically occur when the println() methods are called,
a byte array is written, or a new line character or byte is
encountered in the output.Method Detail |
public void printf(java.lang.String fs, double x)
fs
- Format stringx
- Double to output
java.lang.IllegalArgumentException
- Malformed format stringpublic void printf(java.lang.String fs, float x)
fs
- Format stringx
- Float to output
java.lang.IllegalArgumentException
- Malformed format stringpublic void printf(java.lang.String fs, long x)
fs
- Format stringx
- Long to output
java.lang.IllegalArgumentException
- Malformed format stringpublic void printf(java.lang.String fs, int x)
fs
- Format stringx
- Int to output
java.lang.IllegalArgumentException
- Malformed format stringpublic void printf(java.lang.String fs, java.lang.String x)
fs
- Format stringx
- String to output
java.lang.IllegalArgumentException
- Malformed format stringpublic void printf(java.lang.String fs, char x)
fs
- Format stringx
- Char to output
java.lang.IllegalArgumentException
- 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, java.lang.String x)
fmt
- Formatting objectx
- String to outputPrintfFormat
public void printf(PrintfFormat fmt, char x)
fmt
- Formatting objectx
- Char to outputPrintfFormat
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |