com.softwareag.tamino.db.api.io
Class TOutputStreamWriter

java.lang.Object
  extended by java.io.Writer
      extended by com.softwareag.tamino.db.api.io.TOutputStreamWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable

public class TOutputStreamWriter
extends java.io.Writer

TOutputStreamWriter serves as a bridge to a byte oriented output stream. Furthermore it provide means to record every written character thus after writing is completed the client can obtain the recorded content back. This is particulary interesting for trace purpose.

Version:
$Revision: 1.5 $
Author:
Marcus Schreyer

Field Summary
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
TOutputStreamWriter(java.io.OutputStream outputStream, java.lang.String encoding)
          Initializes the writer with the given output stream and encoding.
 
Method Summary
 void close()
          Closes the writer.
 void flush()
          Flushes the writer.
 java.lang.String getRecordedWriting()
          Gets the recorded content if given.
 boolean isClosed()
          Indicates if writer is closed.
 void useRecordWriting(boolean record)
          Sets the recording of written content.
 void write(char[] cbuf, int off, int len)
          Write a portion of an array of characters.
 void write(int c)
          Write a single character.
 void write(java.lang.String str)
          Writes the given string to the underlying output stream with the give encoding.
 void write(java.lang.String str, int off, int len)
          Write a portion of a string.
 void write(TStreamable streamable)
          Writes the streamable content to the underlying output stream.
 
Methods inherited from class java.io.Writer
append, append, append, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TOutputStreamWriter

public TOutputStreamWriter(java.io.OutputStream outputStream,
                           java.lang.String encoding)
                    throws java.io.UnsupportedEncodingException
Initializes the writer with the given output stream and encoding.

Throws:
java.io.UnsupportedEncodingException
Method Detail

write

public void write(char[] cbuf,
                  int off,
                  int len)
           throws java.io.IOException
Write a portion of an array of characters.

Specified by:
write in class java.io.Writer
Throws:
java.io.IOException

write

public void write(int c)
           throws java.io.IOException
Write a single character.

Overrides:
write in class java.io.Writer
Throws:
java.io.IOException

write

public void write(java.lang.String str,
                  int off,
                  int len)
           throws java.io.IOException
Write a portion of a string.

Overrides:
write in class java.io.Writer
Throws:
java.io.IOException

write

public void write(java.lang.String str)
           throws java.io.IOException
Writes the given string to the underlying output stream with the give encoding.

Overrides:
write in class java.io.Writer
Throws:
java.io.IOException

write

public void write(TStreamable streamable)
           throws java.lang.Exception
Writes the streamable content to the underlying output stream.

Throws:
java.lang.Exception

flush

public void flush()
           throws java.io.IOException
Flushes the writer.

Specified by:
flush in interface java.io.Flushable
Specified by:
flush in class java.io.Writer
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Closes the writer.

Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Writer
Throws:
java.io.IOException

isClosed

public boolean isClosed()
Indicates if writer is closed.


useRecordWriting

public void useRecordWriting(boolean record)
Sets the recording of written content.


getRecordedWriting

public java.lang.String getRecordedWriting()
Gets the recorded content if given.



Copyright (c) 2013 Software AG. All Rights Reserved.