|
Sharkysoft home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--lava.clib.Stdio
Ports of stdio functions.
Details: Stdio
is port of the famous stdio library from the C programming language. By emulating many of the C language's stdio library functions, this class lets die-hard C programmers write Java code without completely converting to the Java API. Rather than wasting valuable time figuring out how to perform the Java equivalent of tasks that are easy in C, the programmer can simply use the methods in this class instead.
printf functions
The printf
functions in the class are by far the most important reason for this class' existance, and are the core component of Printf for Java (go figure). If you learn to use printf well, it will make text formatting in Java extremely easy. Although the printf
, sprintf
, and fprintf
methods included in this class are geared for programmers who are already familiar with the printf
function in C, the printf interfaces are simple enough for anyone to use. Nevertheless, every attempt has been made to ensure that these functions work exactly as experienced C programmers would expect them to.
The printf
methods format text according to the supplied format string, which is represented as a sequence of literal substrings and format specifiers. Literal substrings are echoed in the output, verbatim, but format specifiers are expanded with text-formatted representations of additional variables that are provided.
A format string can contain any number of expandable format specifiers. Thus, a variable number of additional parameters are required to complete the substitution. Since Java does not support variable length argument lists, additional parameters must be passed in an Object
array.
For detailed information on all the cool things you can do with Printf for Java, see Printf for Java.
All of the printf
methods included in this class format data in exactly the same way. However, what is done with the formatted result depends on the specific variation of printf
that is being used. Some of the printf
methods, for example, output directly to System.out
, while others may store the output in a file or string.
Each of the printf
variants accept format strings as either String
objects or lava.clib.stdio.PrintfFormatString
objects. Use of the latter type results in more efficient execution, but is slightly more complex to implement. For more details, see lava.clib.stdio.PrintfFormatString
.
scanf functions
The scanf functions are not available in this release of Lava -- but they are planned for future releases.
Printf
,
PrintfFormatString
,
Va_list
Method Summary | |
static int |
fprintf(java.io.PrintStream printstream,
PrintfFormatString format,
java.lang.Object[] args)
Formats data and sends the result to a PrintStream . |
static int |
fprintf(java.io.PrintStream printstream,
java.lang.String format)
|
static int |
fprintf(java.io.PrintStream printstream,
java.lang.String format,
java.lang.Object[] args)
Formats data and sends the result to a PrintStream . |
static int |
fprintf(java.io.PrintStream printstream,
java.lang.String format,
Va_list args)
Formats data and sends the result to a PrintStream . |
static int |
fprintf(java.io.PrintWriter printwriter,
PrintfFormatString format,
java.lang.Object[] args)
Formats data and sends the result to a PrintWriter . |
static int |
fprintf(java.io.PrintWriter printwriter,
java.lang.String format)
|
static int |
fprintf(java.io.PrintWriter printwriter,
java.lang.String format,
java.lang.Object[] args)
Formats data and sends the result to a PrintWriter . |
static int |
fprintf(java.io.PrintWriter printwriter,
java.lang.String format,
Va_list args)
Formats data and sends the result to a PrintWriter . |
static int |
fprintf(java.io.Writer writer,
PrintfFormatString format,
java.lang.Object[] args)
Formats data and sends the result to a Writer . |
static int |
fprintf(java.io.Writer writer,
java.lang.String format)
|
static int |
fprintf(java.io.Writer writer,
java.lang.String format,
java.lang.Object[] args)
Formats data and sends the result to a Writer . |
static int |
fprintf(java.io.Writer writer,
java.lang.String format,
Va_list args)
Formats data and sends the result to a Writer . |
static int |
printf(PrintfFormatString format,
java.lang.Object[] args)
Formats data and writes the result to System.out . |
static int |
printf(java.lang.String format)
|
static int |
printf(java.lang.String format,
java.lang.Object[] args)
Formats data and writes the result to System.out . |
static int |
printf(java.lang.String format,
Va_list args)
Formats data and writes the result to System.out . |
static int |
sprintf(java.lang.StringBuffer buff,
PrintfFormatString format,
java.lang.Object[] args)
Formats data and stores the result in a StringBuffer. |
static int |
sprintf(java.lang.StringBuffer buff,
java.lang.String format)
|
static int |
sprintf(java.lang.StringBuffer buff,
java.lang.String format,
java.lang.Object[] args)
Formats data and stores the result in a StringBuffer. |
static int |
sprintf(java.lang.StringBuffer buff,
java.lang.String format,
Va_list args)
Formats data and stores the result in a StringBuffer. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Method Detail |
public static final int printf(java.lang.String format, Va_list args)
System.out
. See the discussion at the head of this document.format
- the format stringargs
- data to be formattedPrintfFormatString
,
Va_list
public static final int printf(java.lang.String format, java.lang.Object[] args)
System.out
. See the discussion at the head of this document.format
- the format stringargs
- data to be formattedPrintfFormatString
,
Va_list
public static final int printf(java.lang.String format)
public static final int printf(PrintfFormatString format, java.lang.Object[] args)
System.out
. See the discussion at the head of this document.format
- the format stringargs
- data to be formattedVa_list
public static final int sprintf(java.lang.StringBuffer buff, java.lang.String format, Va_list args)
buff
- the destination bufferformat
- the format stringargs
- data to be formattedPrintfFormatString
,
Va_list
public static final int sprintf(java.lang.StringBuffer buff, java.lang.String format, java.lang.Object[] args)
buff
- the destination bufferformat
- the format stringargs
- data to be formattedPrintfFormatString
,
Va_list
public static final int sprintf(java.lang.StringBuffer buff, java.lang.String format)
public static final int sprintf(java.lang.StringBuffer buff, PrintfFormatString format, java.lang.Object[] args)
buff
- the destination bufferformat
- the format stringargs
- data to be formattedVa_list
public static final int fprintf(java.io.Writer writer, java.lang.String format, Va_list args) throws java.io.IOException
Writer
. See the discussion at the head of this document.writer
- the destination streamformat
- the format stringargs
- data to be formattedPrintfFormatString
,
Va_list
public static final int fprintf(java.io.Writer writer, java.lang.String format, java.lang.Object[] args) throws java.io.IOException
Writer
. See the discussion at the head of this document.writer
- the destination streamformat
- the format stringargs
- data to be formattedPrintfFormatString
,
Va_list
public static final int fprintf(java.io.Writer writer, java.lang.String format) throws java.io.IOException
public static final int fprintf(java.io.Writer writer, PrintfFormatString format, java.lang.Object[] args) throws java.io.IOException
Writer
. See the discussion at the head of this document.writer
- the destination streamformat
- the format stringargs
- data to be formattedVa_list
public static final int fprintf(java.io.PrintStream printstream, java.lang.String format, Va_list args)
PrintStream
. See the discussion at the head of this document.printstream
- the destination streamformat
- the format stringargs
- data to be formattedPrintfFormatString
,
Va_list
public static final int fprintf(java.io.PrintStream printstream, java.lang.String format, java.lang.Object[] args)
PrintStream
. See the discussion at the head of this document.printstream
- the destination streamformat
- the format stringargs
- data to be formattedPrintfFormatString
,
Va_list
public static final int fprintf(java.io.PrintStream printstream, java.lang.String format)
public static final int fprintf(java.io.PrintStream printstream, PrintfFormatString format, java.lang.Object[] args)
PrintStream
. See the discussion at the head of this document.printstream
- the destination streamformat
- the format stringargs
- data to be formattedVa_list
public static final int fprintf(java.io.PrintWriter printwriter, java.lang.String format, Va_list args)
PrintWriter
. See the discussion at the head of this document.printwriter
- the destination streamformat
- the format stringargs
- data to be formattedPrintfFormatString
,
Va_list
public static final int fprintf(java.io.PrintWriter printwriter, java.lang.String format, java.lang.Object[] args)
PrintWriter
. See the discussion at the head of this document.printwriter
- the destination streamformat
- the format stringargs
- data to be formattedPrintfFormatString
,
Va_list
public static final int fprintf(java.io.PrintWriter printwriter, java.lang.String format)
public static final int fprintf(java.io.PrintWriter printwriter, PrintfFormatString format, java.lang.Object[] args)
PrintWriter
. See the discussion at the head of this document.printwriter
- the destination streamformat
- the format stringargs
- data to be formattedVa_list
|
Sharkysoft home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |