org.littleshoot.util
Class FileInputStreamHandler

java.lang.Object
  extended by org.littleshoot.util.FileInputStreamHandler
All Implemented Interfaces:
InputStreamHandler

public class FileInputStreamHandler
extends Object
implements InputStreamHandler

Utility class that writes data from an InputStream to a File.


Constructor Summary
FileInputStreamHandler(File file)
          Creates a new stream handler that will write the InputStream to the specified File.
FileInputStreamHandler(File file, WriteListener writeListener)
          Creates a new stream handler that will write the InputStream to the specified File.
 
Method Summary
 void handleInputStream(InputStream is)
          Handles the specified InputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileInputStreamHandler

public FileInputStreamHandler(File file)
Creates a new stream handler that will write the InputStream to the specified File.

Parameters:
file - The File instance denoting the file path to write to.

FileInputStreamHandler

public FileInputStreamHandler(File file,
                              WriteListener writeListener)
Creates a new stream handler that will write the InputStream to the specified File.

Parameters:
file - The File instance denoting the file path to write to.
writeListener - The listener for write events.
Method Detail

handleInputStream

public void handleInputStream(InputStream is)
                       throws IOException
Description copied from interface: InputStreamHandler
Handles the specified InputStream. Implementors of this method MUST call close on the InputStream when they are done processing it.

Specified by:
handleInputStream in interface InputStreamHandler
Parameters:
is - The InputStream to handle.
Throws:
IOException - If there's a read error reading from the stream or an output error while handling it.


Copyright © 2011-2013 LittleShoot. All Rights Reserved.