com.waveset.util
Class DeferredInputStream

java.lang.Object
  extended bycom.waveset.util.DeferredInputStream

public class DeferredInputStream
extends java.lang.Object

Utility for when you have an input stream which you may which to process out of order or repeatedly. Will keep the input stream in memory up to a certain size and them spool to disk.


Constructor Summary
DeferredInputStream(java.io.InputStream source, int maxMemory)
          Creates a DeferredInputStream.
 
Method Summary
 void cleanup()
          Cleans up any temp files associated with the input stream.
 java.io.InputStream getInputStream()
          Opens the input stream or returns the existing input stream if already open.
 java.lang.String toString()
          Returns a string acceptible for debugging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DeferredInputStream

public DeferredInputStream(java.io.InputStream source,
                           int maxMemory)
                    throws java.io.IOException,
                           WavesetException
Creates a DeferredInputStream. Make sure to call cleanup() when all done in order to cleanup the temp file if one was created.

Method Detail

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Opens the input stream or returns the existing input stream if already open.

Throws:
java.io.IOException

cleanup

public void cleanup()
             throws java.io.IOException
Cleans up any temp files associated with the input stream. Should be called once you're all done.

Throws:
java.io.IOException

toString

public java.lang.String toString()
Returns a string acceptible for debugging.