org.apache.commons.io.output
Class ProxyWriter

java.lang.Object
  extended by java.io.Writer
      extended by java.io.FilterWriter
          extended by org.apache.commons.io.output.ProxyWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable

public class ProxyWriter
extends FilterWriter

A Proxy stream which acts as expected, that is it passes the method calls on to the proxied stream and doesn't change which methods are being called. It is an alternative base class to FilterWriter to increase reusability, because FilterWriter changes the methods being called, such as write(char[]) to write(char[], int, int) and write(String) to write(String, int, int).

Version:
$Id: ProxyWriter.java 610010 2008-01-08 14:50:59Z niallp $
Author:
Stephen Colebourne

Field Summary
 
Fields inherited from class java.io.FilterWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
ProxyWriter(Writer proxy)
          Constructs a new ProxyWriter.
 
Method Summary
 void close()
          Invokes the delegate's close() method.
 void flush()
          Invokes the delegate's flush() method.
 void write(char[] chr)
          Invokes the delegate's write(char[]) method.
 void write(char[] chr, int st, int end)
          Invokes the delegate's write(char[], int, int) method.
 void write(int idx)
          Invokes the delegate's write(int) method.
 void write(String str)
          Invokes the delegate's write(String) method.
 void write(String str, int st, int end)
          Invokes the delegate's write(String) method.
 
Methods inherited from class java.io.Writer
append, append, append, append, append, append
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyWriter

public ProxyWriter(Writer proxy)
Constructs a new ProxyWriter.

Parameters:
proxy - the Writer to delegate to
Method Detail

write

public void write(int idx)
           throws IOException
Invokes the delegate's write(int) method.

Overrides:
write in class FilterWriter
Parameters:
idx - the character to write
Throws:
IOException - if an I/O error occurs

write

public void write(char[] chr)
           throws IOException
Invokes the delegate's write(char[]) method.

Overrides:
write in class Writer
Parameters:
chr - the characters to write
Throws:
IOException - if an I/O error occurs

write

public void write(char[] chr,
                  int st,
                  int end)
           throws IOException
Invokes the delegate's write(char[], int, int) method.

Overrides:
write in class FilterWriter
Parameters:
chr - the characters to write
st - The start offset
end - The number of characters to write
Throws:
IOException - if an I/O error occurs

write

public void write(String str)
           throws IOException
Invokes the delegate's write(String) method.

Overrides:
write in class Writer
Parameters:
str - the string to write
Throws:
IOException - if an I/O error occurs

write

public void write(String str,
                  int st,
                  int end)
           throws IOException
Invokes the delegate's write(String) method.

Overrides:
write in class FilterWriter
Parameters:
str - the string to write
st - The start offset
end - The number of characters to write
Throws:
IOException - if an I/O error occurs

flush

public void flush()
           throws IOException
Invokes the delegate's flush() method.

Specified by:
flush in interface Flushable
Overrides:
flush in class FilterWriter
Throws:
IOException - if an I/O error occurs

close

public void close()
           throws IOException
Invokes the delegate's close() method.

Specified by:
close in interface Closeable
Overrides:
close in class FilterWriter
Throws:
IOException - if an I/O error occurs


Copyright © 2002-2008 The Apache Software Foundation. All Rights Reserved.