com.mucommander.io
Class FilteredOutputStream
java.lang.Object
java.io.OutputStream
com.mucommander.io.FilteredOutputStream
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable
- Direct Known Subclasses:
- LocalFile.LocalOutputStream
public class FilteredOutputStream
- extends java.io.OutputStream
This class provides a proper implementation of an OutputStream filter.
Unlike java.io.FilterOutputStream, this method delegates all methods to an underlying OutputStream
and nothing more. In particular, write(byte[]) and write(byte[], int, int) do not
call write(int) repeatedly (very unefficient) but delegate to the corresponding OutputStream methods. This
makes this class much safer to use from a performance perspective than java.io.FilteredOutputStream.
- Author:
- Maxence Bernard
|
Field Summary |
protected java.io.OutputStream |
out
The underlying OutputStream to filter |
|
Constructor Summary |
FilteredOutputStream(java.io.OutputStream out)
Creates a new FilteredOutputStream that delegates all methods to the provided OutputStream. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
out
protected java.io.OutputStream out
- The underlying OutputStream to filter
FilteredOutputStream
public FilteredOutputStream(java.io.OutputStream out)
- Creates a new FilteredOutputStream that delegates all methods to the provided OutputStream.
- Parameters:
out - the underlying OutputStream to filter
write
public void write(int b)
throws java.io.IOException
- Specified by:
write in class java.io.OutputStream
- Throws:
java.io.IOException
write
public void write(byte[] b)
throws java.io.IOException
- Overrides:
write in class java.io.OutputStream
- Throws:
java.io.IOException
write
public void write(byte[] b,
int off,
int len)
throws java.io.IOException
- Overrides:
write in class java.io.OutputStream
- Throws:
java.io.IOException
flush
public void flush()
throws java.io.IOException
- Specified by:
flush in interface java.io.Flushable- Overrides:
flush in class java.io.OutputStream
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close in interface java.io.Closeable- Overrides:
close in class java.io.OutputStream
- Throws:
java.io.IOException
This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard