ProGuard

proguard.io
Class FilteredDataEntryWriter

java.lang.Object
  extended byproguard.io.FilteredDataEntryWriter
All Implemented Interfaces:
DataEntryWriter

public class FilteredDataEntryWriter
extends Object
implements DataEntryWriter

This DataEntryWriter delegates to one of two other DataEntryWriter instances, depending on whether the data entry passes through a given data entry filter or not.


Constructor Summary
FilteredDataEntryWriter(DataEntryFilter dataEntryFilter, DataEntryWriter acceptedDataEntryWriter)
          Creates a new FilteredDataEntryWriter with only a writer for accepted data entries.
FilteredDataEntryWriter(DataEntryFilter dataEntryFilter, DataEntryWriter acceptedDataEntryWriter, DataEntryWriter rejectedDataEntryWriter)
          Creates a new FilteredDataEntryWriter.
 
Method Summary
 void close()
          Finishes writing all data entries.
 OutputStream getOutputStream(DataEntry dataEntry)
          Returns an output stream for writing data.
 OutputStream getOutputStream(DataEntry dataEntry, Finisher finisher)
          Returns an output stream for writing data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilteredDataEntryWriter

public FilteredDataEntryWriter(DataEntryFilter dataEntryFilter,
                               DataEntryWriter acceptedDataEntryWriter)
Creates a new FilteredDataEntryWriter with only a writer for accepted data entries.

Parameters:
dataEntryFilter - the data entry filter.
acceptedDataEntryWriter - the DataEntryWriter to which the writing will be delegated if the filter accepts the data entry. May be null.

FilteredDataEntryWriter

public FilteredDataEntryWriter(DataEntryFilter dataEntryFilter,
                               DataEntryWriter acceptedDataEntryWriter,
                               DataEntryWriter rejectedDataEntryWriter)
Creates a new FilteredDataEntryWriter.

Parameters:
dataEntryFilter - the data entry filter.
acceptedDataEntryWriter - the DataEntryWriter to which the writing will be delegated if the filter accepts the data entry. May be null.
rejectedDataEntryWriter - the DataEntryWriter to which the writing will be delegated if the filter does not accept the data entry. May be null.
Method Detail

getOutputStream

public OutputStream getOutputStream(DataEntry dataEntry)
                             throws IOException
Description copied from interface: DataEntryWriter
Returns an output stream for writing data. The caller must not close the output stream; closing the output stream is the responsibility of the implementation of this interface.

Specified by:
getOutputStream in interface DataEntryWriter
Parameters:
dataEntry - the data entry for which the output stream is to be created.
Returns:
the output stream. The stream may be null to indicate that the data entry should not be written.
Throws:
IOException

getOutputStream

public OutputStream getOutputStream(DataEntry dataEntry,
                                    Finisher finisher)
                             throws IOException
Description copied from interface: DataEntryWriter
Returns an output stream for writing data. The caller must not close the output stream; closing the output stream is the responsibility of the implementation of this interface.

Specified by:
getOutputStream in interface DataEntryWriter
Parameters:
dataEntry - the data entry for which the output stream is to be created.
finisher - the optional finisher that will be called before this class closes the output stream (at some later point in time) that will be returned (now).
Returns:
the output stream. The stream may be null to indicate that the data entry should not be written.
Throws:
IOException

close

public void close()
           throws IOException
Description copied from interface: DataEntryWriter
Finishes writing all data entries.

Specified by:
close in interface DataEntryWriter
Throws:
IOException

ProGuard