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.
-
Field Summary
Modifier and TypeFieldDescriptionprivate static String
private PrintWriter
private static final Locale
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the output stream.void
Print a formatted string using the specified format string and arguments, and then flush the output stream.void
Print a formatted string using the specified locale, format string and arguments, and then flush the output stream.static void
A test client.void
print()
Flush the output stream.void
print
(boolean x) Print an boolean and then flush the output stream.void
print
(byte x) Print a byte and then flush the output stream.void
print
(char x) Print an char and then flush the output stream.void
print
(double x) Print an double and then flush the output stream.void
print
(float x) Print a float and then flush the output stream.void
print
(int x) Print an int and then flush the output stream.void
print
(long x) Print a long and then flush the output stream.void
Print an object and then flush the output stream.void
void
void
println()
Terminate the line.void
println
(boolean x) Print a boolean and then terminate the line.void
println
(byte x) Print a byte and then terminate the line.void
println
(char x) Print a char and then terminate the line.void
println
(double x) Print an double and then terminate the line.void
println
(float x) Print a float and then terminate the line.void
println
(int x) Print an int and then terminate the line.void
println
(long x) Print a long and then terminate the line.void
Print an object and then terminate the line.
-
Field Details
-
charsetName
-
US_LOCALE
-
out
-
-
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.
-