org.geotools.io
Class EchoWriter

java.lang.Object
  extended byjava.io.Writer
      extended byjava.io.FilterWriter
          extended byorg.geotools.io.EchoWriter

public class EchoWriter
extends java.io.FilterWriter

A writer that copy all output to an other stream. This writer can be used for perfoming an exact copy of what is sent to an other writer. For example, it may be used for echoing to the standard output the content sent to a file. This writer is usefull for debugging purpose.

Since:
2.1
Version:
$Id: EchoWriter.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Martin Desruisseaux

Field Summary
 
Fields inherited from class java.io.FilterWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
EchoWriter(java.io.Writer main)
          Creates a writer that will echo to the standard output.
EchoWriter(java.io.Writer main, java.io.Writer echo)
          Creates a copy writter for the specified stream.
 
Method Summary
 void close()
          Close the main stream, If this object has been constructed with the one argument constructor (i.e.
 void flush()
          Flush both streams.
 void write(char[] cbuf)
          Write an array of characters.
 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)
          Write a string.
 void write(java.lang.String str, int off, int len)
          Write a portion of a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EchoWriter

public EchoWriter(java.io.Writer main)
Creates a writer that will echo to the standard output. Each line to that standard output will be numbered.

Parameters:
main - The main stream.

EchoWriter

public EchoWriter(java.io.Writer main,
                  java.io.Writer echo)
Creates a copy writter for the specified stream.

Parameters:
main - The main stream.
echo - The echo stream.
Method Detail

write

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

Throws:
java.io.IOException - If an I/O error occurs

write

public void write(char[] cbuf)
           throws java.io.IOException
Write an array of characters.

Parameters:
cbuf - Buffer of characters to be written
Throws:
java.io.IOException - If an I/O error occurs

write

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

Parameters:
cbuf - Buffer of characters to be written
off - Offset from which to start reading characters
len - Number of characters to be written
Throws:
java.io.IOException - If an I/O error occurs

write

public void write(java.lang.String str)
           throws java.io.IOException
Write a string.

Parameters:
str - String to be written
Throws:
java.io.IOException - If an I/O error occurs

write

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

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

flush

public void flush()
           throws java.io.IOException
Flush both streams.

Throws:
java.io.IOException - If an I/O error occurs

close

public void close()
           throws java.io.IOException
Close the main stream, If this object has been constructed with the one argument constructor (i.e. if the echo stream is the standard output), then the echo stream will not be closed. Otherwise it will be closed too.

Throws:
java.io.IOException - If an I/O error occurs


Copyright © GeoTools. All Rights Reserved.