it.jnrpe.utils
Class StreamManager

java.lang.Object
  extended by it.jnrpe.utils.StreamManager

public class StreamManager
extends Object

Utility class for handling streams.

Author:
Massimiliano Ziccardi

Constructor Summary
StreamManager()
           
 
Method Summary
 void closeAll()
          Closes all handles streams and readers.
 InputStream getInputStream(File f)
          Returns an InputStream on the given file
 OutputStream getOutputStream(File f)
          Returns an OutputStream on the given file
 InputStream handle(InputStream in)
          Handles the received InputStream and returns it.
 OutputStream handle(OutputStream out)
          Handles the received OutputStream and returns it.
 Reader handle(Reader r)
          Handles the received Reader and returns it
 Writer handle(Writer w)
          Handles the received Writer and returns it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamManager

public StreamManager()
Method Detail

handle

public InputStream handle(InputStream in)
Handles the received InputStream and returns it.

Parameters:
in -
Returns:

handle

public OutputStream handle(OutputStream out)
Handles the received OutputStream and returns it.

Parameters:
out -
Returns:

handle

public Reader handle(Reader r)
Handles the received Reader and returns it

Parameters:
r -
Returns:

handle

public Writer handle(Writer w)
Handles the received Writer and returns it

Parameters:
w -
Returns:

getInputStream

public InputStream getInputStream(File f)
                           throws FileNotFoundException
Returns an InputStream on the given file

Parameters:
f -
Returns:
Throws:
FileNotFoundException

getOutputStream

public OutputStream getOutputStream(File f)
                             throws FileNotFoundException
Returns an OutputStream on the given file

Parameters:
f -
Returns:
Throws:
FileNotFoundException

closeAll

public void closeAll()
Closes all handles streams and readers. Non exception is thrown. This method should be called in the finally block.



Copyright © 2012. All Rights Reserved.