com.plumtree.openfoundation.io
Class XPWriter

java.lang.Object
  extended bycom.plumtree.openfoundation.io.XPWriter
Direct Known Subclasses:
XPBufferedWriter, XPOutputStreamWriter

public class XPWriter
extends java.lang.Object

Corresponds to java.io.Writer and System.IO.TextWriter, and is the type returned by XPSystem.Out.GetWriter() and XPSystem.Error.GetWriter().

Author:
JeffM

Field Summary
protected  java.io.Writer writer
          Not exposed via GetUnderlyingObject because that would break the polymorphism contract of the previously existing subclass XPBufferedWriter.
 
Constructor Summary
protected XPWriter()
          Required to support subclasses, which must then assign to super.writer.
  XPWriter(java.io.PrintStream stdOutOrError)
          Used by XPSystem to expose standard output or standard error output as an instance of a wrapper around Writer, matching .NET.
  XPWriter(java.io.Writer underlyingWriter)
          Constructs a XPWriter object.
 
Method Summary
 void Close()
          Close the underlying writer.
 void Flush()
          Clears all the buffers for this stream and cause any buffered data to be written to the underlying device.
static XPWriter NullWriter()
          Returns an instance of XPWriter not backed by a stream, which discards input.
 void Write(char[] buffer)
          Writes an array of characters to the underlying writer.
 void Write(int b)
          Writes a single character to the stream.
 void Write(java.lang.String outStr)
          Writes a string.
 void Write(java.lang.String buffer, int offset, int count)
          Writes a portion of a string.
 void WriteLine()
          Writes the platform-defined line end character(s).
 void WriteLine(char[] buffer)
          Writes an array of characters to the stream, followed by a newline.
 void WriteLine(int outChar)
          Writes a character represented as an int, followed by the platform-defined line end character(s).
 void WriteLine(java.lang.String outStr)
          Writes a string followed by the platform-defined line end character(s).
 void WriteLine(java.lang.String buffer, int offset, int count)
          Writes a portion of a string followed by the platform-specific newline.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

writer

protected java.io.Writer writer
Not exposed via GetUnderlyingObject because that would break the polymorphism contract of the previously existing subclass XPBufferedWriter.

Constructor Detail

XPWriter

protected XPWriter()
Required to support subclasses, which must then assign to super.writer.


XPWriter

public XPWriter(java.io.Writer underlyingWriter)
Constructs a XPWriter object.

Parameters:
underlyingWriter - a Writer object

XPWriter

public XPWriter(java.io.PrintStream stdOutOrError)
Used by XPSystem to expose standard output or standard error output as an instance of a wrapper around Writer, matching .NET.

Parameters:
stdOutOrError - a Printstream object
Method Detail

Close

public void Close()
Close the underlying writer.

Throws:
XPIOException

Flush

public void Flush()
Clears all the buffers for this stream and cause any buffered data to be written to the underlying device.

Throws:
XPIOException

Write

public void Write(int b)
Writes a single character to the stream.

Parameters:
b - A character
Throws:
XPIOException

Write

public void Write(char[] buffer)
Writes an array of characters to the underlying writer.

Parameters:
buffer - Array of characters
Throws:
XPIOException

Write

public void Write(java.lang.String buffer,
                  int offset,
                  int count)
Writes a portion of a string.

Parameters:
buffer - A string
offset - Offset from which to start reading characters
count - Number of characters to write
Throws:
XPIOException

Write

public void Write(java.lang.String outStr)
Writes a string.

Parameters:
outStr - A string
Throws:
XPIOException

WriteLine

public void WriteLine()
Writes the platform-defined line end character(s).

Throws:
XPIOException

WriteLine

public void WriteLine(java.lang.String outStr)
Writes a string followed by the platform-defined line end character(s).

Parameters:
outStr - A string
Throws:
XPIOException

WriteLine

public void WriteLine(int outChar)
Writes a character represented as an int, followed by the platform-defined line end character(s).

Parameters:
outChar - an int representing the character to output
Throws:
XPIOException

WriteLine

public void WriteLine(char[] buffer)
Writes an array of characters to the stream, followed by a newline.

Parameters:
buffer - Array of characters
Throws:
XPIOException

WriteLine

public void WriteLine(java.lang.String buffer,
                      int offset,
                      int count)
Writes a portion of a string followed by the platform-specific newline.

Parameters:
buffer - A string
offset - Offset from which to start reading characters
count - Number of characters to write
Throws:
XPIOException

NullWriter

public static XPWriter NullWriter()
Returns an instance of XPWriter not backed by a stream, which discards input.

Returns:
a XPWriter


Copyright 2002, 2003, 2004 Plumtree Software Inc. All Rights Reserved.