proguard.io
Class CascadingDataEntryWriter

java.lang.Object
  extended by proguard.io.CascadingDataEntryWriter
All Implemented Interfaces:
DataEntryWriter

public class CascadingDataEntryWriter
extends java.lang.Object
implements DataEntryWriter

This DataEntryWriter delegates to a given DataEntryWriter, or failing that, to another given DataEntryWriter.


Constructor Summary
CascadingDataEntryWriter(DataEntryWriter dataEntryWriter1, DataEntryWriter dataEntryWriter2)
          Creates a new CascadingDataEntryWriter.
 
Method Summary
 void close()
          Finishes writing all data entries.
 boolean createDirectory(DataEntry dataEntry)
          Creates a directory.
 java.io.OutputStream getOutputStream(DataEntry dataEntry)
          Returns an output stream for writing data.
 java.io.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

CascadingDataEntryWriter

public CascadingDataEntryWriter(DataEntryWriter dataEntryWriter1,
                                DataEntryWriter dataEntryWriter2)
Creates a new CascadingDataEntryWriter.

Parameters:
dataEntryWriter1 - the DataEntryWriter to which the writing will be delegated first.
dataEntryWriter2 - the DataEntryWriter to which the writing will be delegated, if the first one can't provide an output stream.
Method Detail

createDirectory

public boolean createDirectory(DataEntry dataEntry)
                        throws java.io.IOException
Description copied from interface: DataEntryWriter
Creates a directory.

Specified by:
createDirectory in interface DataEntryWriter
Parameters:
dataEntry - the data entry for which the directory is to be created.
Returns:
whether the directory has been created.
Throws:
java.io.IOException

getOutputStream

public java.io.OutputStream getOutputStream(DataEntry dataEntry)
                                     throws java.io.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:
java.io.IOException

getOutputStream

public java.io.OutputStream getOutputStream(DataEntry dataEntry,
                                            Finisher finisher)
                                     throws java.io.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:
java.io.IOException

close

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

Specified by:
close in interface DataEntryWriter
Throws:
java.io.IOException