java::io::Writer Class Reference

Inheritance diagram for java::io::Writer:

Inheritance graph
java::io::BufferedWriterjava::io::CharArrayWriterjava::io::FilterWriterjava::io::OutputStreamWriterjava::lang::Interfacejava::lang::Objectjava::io::FileWriter
[legend]
Collaboration diagram for java::io::Writer:

Collaboration graph
java::lang::Interfacejava::lang::Object
[legend]

List of all members.


Detailed Description

Interface for writing to character streams.

The only methods that a subclass must implement are write(char[], int, int), flush(), and close(). Most subclasses, however, will override some of the methods defined here in order to provide higher efficiency, additional functionality, or both.

Version:
1.20, 01/12/03
Author:
Mark Reinhold
Since:
JDK1.1

Public Member Functions

virtual void write (jint c)=0
 Write a single character.
virtual void write (const Array< jchar > &b, jint off=0, jint len=-1)=0
 Write a portion of an array of characters.
virtual void write (const String &str, jint off=0, jint len=-1)=0
 Write a portion of a string.
virtual void flush ()
 Flush the stream.
virtual void close ()
 Close the stream, flushing it first.

Member Function Documentation

virtual void java::io::Writer::write ( jint  c  )  [pure virtual]

Write a single character.

The character to be written is contained in the 16 low-order bits of the given integer value; the 16 high-order bits are ignored.

Subclasses that intend to support efficient single-character output should override this method.

Parameters:
c int specifying a character to be written.
Exceptions:
IOException If an I/O error occurs

Implemented in java::io::BufferedWriter, java::io::CharArrayWriter, java::io::FilterWriter, and java::io::OutputStreamWriter.

virtual void java::io::Writer::write ( const Array< jchar > &  b,
jint  off = 0,
jint  len = -1 
) [pure virtual]

Write a portion of an array of characters.

Parameters:
cbuf Array of characters
off Offset from which to start writing characters
len Number of characters to write
Exceptions:
IOException If an I/O error occurs

Implemented in java::io::BufferedWriter, java::io::CharArrayWriter, java::io::FilterWriter, and java::io::OutputStreamWriter.

virtual void java::io::Writer::write ( const String str,
jint  off = 0,
jint  len = -1 
) [pure virtual]

Write a portion of a string.

Parameters:
str A String
off Offset from which to start writing characters
len Number of characters to write
Exceptions:
IOException If an I/O error occurs

Implemented in java::io::BufferedWriter, java::io::CharArrayWriter, java::io::FilterWriter, and java::io::OutputStreamWriter.

virtual void java::io::Writer::flush (  )  [virtual]

Flush the stream.

If the stream has saved any characters from the various write() methods in a buffer, write them immediately to their intended destination. Then, if that destination is another character or byte stream, flush it. Thus one flush() invocation will flush all the buffers in a chain of Writers and OutputStreams.

Exceptions:
IOException If an I/O error occurs

Reimplemented in java::io::BufferedWriter, java::io::FilterWriter, and java::io::OutputStreamWriter.

virtual void java::io::Writer::close (  )  [virtual]

Close the stream, flushing it first.

Once a stream has been closed, further write() or flush() invocations will cause an IOException to be thrown. Closing a previously-closed stream, however, has no effect.

Exceptions:
IOException If an I/O error occurs

Reimplemented in java::io::BufferedWriter, java::io::FilterWriter, and java::io::OutputStreamWriter.


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:56:33 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3