|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcds.util.CFormat
Provides methods for formatted printing a-la C printf.
This class is the the top-level class of the printf package.
All the fields and methods in this class are static.
The static fields control the behavior of the methods,
and the methods do printing to System.out (printf()
), an
arbitrary PrintStream
(fprintf()
), or a String
(sprintf()
).
Field Summary | |
static boolean |
debug
Print debugging diagnostics. |
static char |
DECIMAL_POINT
|
(package private) static java.util.Hashtable |
formatNodesHashTable
Keep a hash table of recently-encountered format strings. |
(package private) static int |
gThreshold
The exponent threshold below which %g should print as %f rather than %e. |
(package private) static int |
maxRememberedFormatStrings
Size of table of cached parsed format strings. |
static char |
MINUS_SIGN
|
static boolean |
nonStringPercentSIsError
Is supplying a non-string object for %s an error? |
(package private) static DoublyLinkedList |
recentFormatStrings
A list of recently-encountered format strings, with the most-recently-used at the head of the list. |
static boolean |
trapErrors
If trapErrors is true, sprintf catches exceptions internally, prints an error message, prints or returns partial results, and returns to the caller. |
static boolean |
useInternationalizationNaNandInf
Use the NaN and Infinity symbol strings from java.text.decimalFormatSymbols. |
static boolean |
useNonLocaleChars
Use non Locale decimal point, zero digit and minus sign, but the common signs used in science |
static char |
ZERO_DIGIT
|
Constructor Summary | |
CFormat()
|
Method Summary | |
static void |
fprintf(java.io.PrintStream out,
java.lang.String format)
Equivalent to printf() with a format string and
zero print arguments.
|
static void |
fprintf(java.io.PrintStream out,
java.lang.String format,
VarArgs args)
Format the arguments and print the result on the PrintStream out . |
static void |
main(java.lang.String[] args)
|
static void |
printf(java.lang.String format)
Equivalent to printf() with a format string and
zero print arguments.
|
static void |
printf(java.lang.String format,
VarArgs args)
Format the arguments and print the result on System.out . |
static java.lang.String |
sprintf(java.lang.String format)
Equivalent to sprintf() with a format string and
zero print arguments.
|
static java.lang.String |
sprintf(java.lang.String format,
VarArgs args)
Format the arguments according to the format string, and return the result as a String . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static boolean trapErrors
public static boolean nonStringPercentSIsError
toString()
of the object is
used to get a string.
public static boolean debug
static int gThreshold
static int maxRememberedFormatStrings
public static boolean useInternationalizationNaNandInf
public static boolean useNonLocaleChars
public static char DECIMAL_POINT
public static char ZERO_DIGIT
public static char MINUS_SIGN
static java.util.Hashtable formatNodesHashTable
static DoublyLinkedList recentFormatStrings
Constructor Detail |
public CFormat()
Method Detail |
public static void main(java.lang.String[] args)
public static java.lang.String sprintf(java.lang.String format, VarArgs args)
String
.
format
- the C like formatting stringargs
- the parameters list
public static java.lang.String sprintf(java.lang.String format)
sprintf()
with a format string and
zero print arguments.
(It is an error if the format string contains any % codes,
except for %%).
format
- C like format string
public static void printf(java.lang.String format, VarArgs args)
System.out
.
format
- the C like formatting stringargs
- the parameters listpublic static void printf(java.lang.String format)
printf()
with a format string and
zero print arguments.
(It is an error if the format string contains any % codes,
except for %%).
format
- the C like formatting stringpublic static void fprintf(java.io.PrintStream out, java.lang.String format, VarArgs args)
PrintStream
out
.
out
- a PrintStreamoutput objectformat
- the C like formatting stringargs
- the parameters listpublic static void fprintf(java.io.PrintStream out, java.lang.String format)
printf()
with a format string and
zero print arguments.
(It is an error if the format string contains any % codes,
except for %%).
out
- a PrintStreamoutput objectformat
- the C like formatting string
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |