Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

java::io::PrintStream Class Reference

A PrintStream adds functionality to another output stream, namely the ability to print representations of various data values conveniently. More...

#include <java_io_PrintStream.h>

Inheritance diagram for java::io::PrintStream:

Inheritance graph
[legend]
Collaboration diagram for java::io::PrintStream:

Collaboration graph
[legend]
List of all members.

Public Types

enum  {
  xmogDefaultFlags = xmog_base::GLOBAL, xmogMajorVersion = 3, xmogMinorVersion = 2, xmogPatchVersion = 9,
  xmogBuildNumber = 2047
}
typedef ::xmog_java_array_template<
::java::io::PrintStream
array1D
typedef ::xmog_java_array_template<
::xmog_java_array_template<
::java::io::PrintStream > > 
array2D

Public Member Functions

virtual bool checkError (::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Flush the stream and check its error state.
virtual void close (::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Close the stream.
virtual void flush (::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Flush the stream.
virtual void print (const ::xmog_java_char_array &s,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Print an array of characters.
virtual void print (const ::java::lang::Object &obj,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Print an object.
virtual void print (const ::java::lang::String &s,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Print a string.
virtual void print (jdouble d,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Print a double-precision floating-point number.
virtual void print (jfloat f,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Print a floating-point number.
virtual void print (jlong l,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Print a long integer.
virtual void print (jchar c,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Print a character.
virtual void print (bool b,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Print a boolean value.
virtual void print (jint i,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Print an integer.
virtual void println (const ::xmog_java_char_array &x,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Print an array of characters and then terminate the line.
virtual void println (const ::java::lang::String &x,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Print a String and then terminate the line.
virtual void println (const ::java::lang::Object &x,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Print an Object and then terminate the line.
virtual void println (jdouble x,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Print a double and then terminate the line.
virtual void println (jfloat x,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Print a float and then terminate the line.
virtual void println (jchar x,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Print a character and then terminate the line.
virtual void println (jlong x,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Print a long and then terminate the line.
virtual void println (jint x,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Print an integer and then terminate the line.
virtual void println (bool x,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Print a boolean and then terminate the line.
virtual void println (::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Terminate the current line by writing the line separator string.
 PrintStream (const ::java::io::OutputStream &out, bool autoFlush, const ::java::lang::String &encoding,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Create a new print stream.
 PrintStream (const ::java::io::OutputStream &out, bool autoFlush,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Create a new print stream.
 PrintStream (const ::java::io::OutputStream &out,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Create a new print stream.
virtual void write (const ::xmog_java_byte_array &buf, jint off, jint len,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Write len bytes from the specified byte array starting at offset off to this stream.
virtual void write (jint b,::xmog_localenv *p_xenv=NULL, xmog_flags f_xflags=xmogDefaultFlags)
 Write the specified byte to this stream.

Detailed Description

A PrintStream adds functionality to another output stream, namely the ability to print representations of various data values conveniently.

Two other features are provided as well. Unlike other output streams, a PrintStream never throws an IOException; instead, exceptional situations merely set an internal flag that can be tested via the checkError method. Optionally, a PrintStream can be created so as to flush automatically; this means that the flush method is automatically invoked after a byte array is written, one of the println methods is invoked, or a newline character or byte ('
'
) is written.

All characters printed by a PrintStream are converted into bytes using the platform's default character encoding. The class should be used in situations that require writing characters rather than bytes.

Author:
Frank Yellin

Mark Reinhold


Constructor & Destructor Documentation

java::io::PrintStream::PrintStream const ::java::io::OutputStream out,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
 

Create a new print stream.

This stream will not flush automatically.

Parameters:
out The output stream to which values and objects will be printed
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.

java::io::PrintStream::PrintStream const ::java::io::OutputStream out,
bool  autoFlush,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
 

Create a new print stream.

Parameters:
out The output stream to which values and objects will be printed
autoFlush A boolean; if true, the output buffer will be flushed whenever a byte array is written, one of the println methods is invoked, or a newline character or byte ('
'
) is written
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.

java::io::PrintStream::PrintStream const ::java::io::OutputStream out,
bool  autoFlush,
const ::java::lang::String encoding,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
 

Create a new print stream.

Parameters:
out The output stream to which values and objects will be printed
autoFlush A boolean; if true, the output buffer will be flushed whenever a byte array is written, one of the println methods is invoked, or a newline character or byte ('
'
) is written
encoding The name of a supported character encoding
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.


Member Function Documentation

virtual bool java::io::PrintStream::checkError ::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Flush the stream and check its error state.

The internal error state is set to true when the underlying output stream throws an IOException other than InterruptedIOException, and when the setError method is invoked. If an operation on the underlying output stream throws an InterruptedIOException, then the PrintStream converts the exception back into an interrupt by doing:

                     Thread.currentThread().interrupt();

or the equivalent.

Parameters:
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:
True if and only if this stream has encountered an IOException other than InterruptedIOException, or the setError method has been invoked

virtual void java::io::PrintStream::close ::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Close the stream.

This is done by flushing the stream and then closing the underlying output stream.

Parameters:
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

Reimplemented from java::io::FilterOutputStream.

virtual void java::io::PrintStream::flush ::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Flush the stream.

This is done by writing any buffered output bytes to the underlying output stream and then flushing that stream.

Parameters:
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

Reimplemented from java::io::FilterOutputStream.

virtual void java::io::PrintStream::print const ::xmog_java_char_array s,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Print an array of characters.

The characters are converted into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the method.

Parameters:
s The array of chars to be printed
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

virtual void java::io::PrintStream::print const ::java::lang::Object obj,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Print an object.

The string produced by the method is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the method.

Parameters:
obj The Object to be printed
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

virtual void java::io::PrintStream::print const ::java::lang::String s,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Print a string.

If the argument is null then the string "null" is printed. Otherwise, the string's characters are converted into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the method.

Parameters:
s The String to be printed
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

virtual void java::io::PrintStream::print jdouble  d,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Print a double-precision floating-point number.

The string produced by is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the method.

Parameters:
d The double to be printed
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

virtual void java::io::PrintStream::print jfloat  f,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Print a floating-point number.

The string produced by is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the method.

Parameters:
f The float to be printed
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

virtual void java::io::PrintStream::print jlong  l,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Print a long integer.

The string produced by is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the method.

Parameters:
l The long to be printed
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

virtual void java::io::PrintStream::print jchar  c,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Print a character.

The character is translated into one or more bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the method.

Parameters:
c The char to be printed
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

virtual void java::io::PrintStream::print bool  b,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Print a boolean value.

The string produced by is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the method.

Parameters:
b The boolean to be printed
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

virtual void java::io::PrintStream::print jint  i,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Print an integer.

The string produced by is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the method.

Parameters:
i The int to be printed
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

virtual void java::io::PrintStream::println const ::xmog_java_char_array x,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Print an array of characters and then terminate the line.

This method behaves as though it invokes and then .

Parameters:
x an array of chars to print.
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

virtual void java::io::PrintStream::println const ::java::lang::String x,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Print a String and then terminate the line.

This method behaves as though it invokes and then .

Parameters:
x The String to be printed.
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

virtual void java::io::PrintStream::println const ::java::lang::Object x,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Print an Object and then terminate the line.

This method behaves as though it invokes and then .

Parameters:
x The Object to be printed.
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

virtual void java::io::PrintStream::println jdouble  x,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Print a double and then terminate the line.

This method behaves as though it invokes and then .

Parameters:
x The double to be printed.
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

virtual void java::io::PrintStream::println jfloat  x,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Print a float and then terminate the line.

This method behaves as though it invokes and then .

Parameters:
x The float to be printed.
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

virtual void java::io::PrintStream::println jchar  x,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Print a character and then terminate the line.

This method behaves as though it invokes and then .

Parameters:
x The char to be printed.
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

virtual void java::io::PrintStream::println jlong  x,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Print a long and then terminate the line.

This method behaves as though it invokes and then .

Parameters:
x a The long to be printed.
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

virtual void java::io::PrintStream::println jint  x,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Print an integer and then terminate the line.

This method behaves as though it invokes and then .

Parameters:
x The int to be printed.
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

virtual void java::io::PrintStream::println bool  x,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Print a boolean and then terminate the line.

This method behaves as though it invokes and then .

Parameters:
x The boolean to be printed
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

virtual void java::io::PrintStream::println ::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Terminate the current line by writing the line separator string.

The line separator string is defined by the system property line.separator, and is not necessarily a single newline character ('
'
).

Parameters:
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

virtual void java::io::PrintStream::write const ::xmog_java_byte_array buf,
jint  off,
jint  len,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Write len bytes from the specified byte array starting at offset off to this stream.

If automatic flushing is enabled then the flush method will be invoked.

Note that the bytes will be written as given; to write characters that will be translated according to the platform's default character encoding, use the print(char) or println(char) methods.

Parameters:
buf A byte array
off Offset from which to start taking bytes
len Number of bytes to write
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

Reimplemented from java::io::FilterOutputStream.

virtual void java::io::PrintStream::write jint  b,
::xmog_localenv p_xenv = NULL,
xmog_flags  f_xflags = xmogDefaultFlags
[virtual]
 

Write the specified byte to this stream.

If the byte is a newline and automatic flushing is enabled then the flush method will be invoked.

Note that the byte is written as given; to write a character that will be translated according to the platform's default character encoding, use the print(char) or println(char) methods.

Parameters:
b The byte to be written
p_xenv the local call environment. The default value is NULL.
f_xflags the flags that allow control over the reference type and other internal matters. The default value is xmog_base::GLOBAL.
Returns:

Reimplemented from java::io::FilterOutputStream.


The documentation for this class was generated from the following file:
Generated on Fri Jun 16 10:19:17 2006 for JMS Courier for C++ by  doxygen 1.4.1