Package stdlib
Class Out
java.lang.Object
stdlib.Out
This class provides methods for writing strings and numbers to
various output streams, including standard output, file, and sockets.
For additional documentation, see Section 3.1 of Introduction to Programming in Java: An Interdisciplinary Approach by Robert Sedgewick and Kevin Wayne.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the output stream.voidPrint a formatted string using the specified format string and arguments, and then flush the output stream.voidPrint a formatted string using the specified locale, format string and arguments, and then flush the output stream.static voidA test client.voidprint()Flush the output stream.voidprint(boolean x) Print an boolean and then flush the output stream.voidprint(byte x) Print a byte and then flush the output stream.voidprint(char x) Print an char and then flush the output stream.voidprint(double x) Print an double and then flush the output stream.voidprint(float x) Print a float and then flush the output stream.voidprint(int x) Print an int and then flush the output stream.voidprint(long x) Print a long and then flush the output stream.voidPrint an object and then flush the output stream.voidvoidvoidprintln()Terminate the line.voidprintln(boolean x) Print a boolean and then terminate the line.voidprintln(byte x) Print a byte and then terminate the line.voidprintln(char x) Print a char and then terminate the line.voidprintln(double x) Print an double and then terminate the line.voidprintln(float x) Print a float and then terminate the line.voidprintln(int x) Print an int and then terminate the line.voidprintln(long x) Print a long and then terminate the line.voidPrint an object and then terminate the line.
-
Constructor Details
-
Out
Create an Out object using an OutputStream. -
Out
public Out()Create an Out object using standard output. -
Out
Create an Out object using a Socket. -
Out
Create an Out object using a file specified by the given name.
-
-
Method Details
-
close
Close the output stream. -
println
Terminate the line. -
println
Print an object and then terminate the line. -
println
Print a boolean and then terminate the line. -
println
Print a char and then terminate the line. -
println
Print an double and then terminate the line. -
println
Print a float and then terminate the line. -
println
Print an int and then terminate the line. -
println
Print a long and then terminate the line. -
println
Print a byte and then terminate the line. -
print
Flush the output stream. -
print
Print an object and then flush the output stream. -
print
Print an boolean and then flush the output stream. -
print
Print an char and then flush the output stream. -
print
Print an double and then flush the output stream. -
print
Print a float and then flush the output stream. -
print
Print an int and then flush the output stream. -
print
Print a long and then flush the output stream. -
print
Print a byte and then flush the output stream. -
format
Print a formatted string using the specified format string and arguments, and then flush the output stream. -
printf
-
format
Print a formatted string using the specified locale, format string and arguments, and then flush the output stream. -
printf
-
main
A test client.
-