org.omnaest.utils.streams
Class StreamConnector

java.lang.Object
  extended by org.omnaest.utils.streams.StreamConnector

public class StreamConnector
extends Object

This class offers methods to connect to streams to each other.

Author:
Omnaest

Nested Class Summary
static class StreamConnector.TransferResult
           
 
Constructor Summary
StreamConnector()
           
 
Method Summary
static void connect(InputStream inputStream, OutputStream outputStream)
          Connects a given InputStream to a given OutputStream without closing the streams but flushing the OutputStream.
static void connect(InputStream source, StringBuffer destination, String encoding)
          Transfers the data of an InputStream into a StringBuffer using the given encoding.
static void connect(StringBuffer source, OutputStream destination, String encoding)
          Transfers the data of a StringBuffer into an OutputStream.
static StreamConnector.TransferResult transfer(InputStream inputStream, OutputStream outputStream)
          Transfers the data from the given InputStream to the given OutputStream returning a StreamConnector.TransferResult
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamConnector

public StreamConnector()
Method Detail

connect

public static void connect(InputStream inputStream,
                           OutputStream outputStream)
                    throws IOException
Connects a given InputStream to a given OutputStream without closing the streams but flushing the OutputStream.

Parameters:
inputStream -
outputStream -
Throws:
IOException

transfer

public static StreamConnector.TransferResult transfer(InputStream inputStream,
                                                      OutputStream outputStream)
Transfers the data from the given InputStream to the given OutputStream returning a StreamConnector.TransferResult

Parameters:
inputStream -
outputStream -
Returns:
StreamConnector.TransferResult

connect

public static void connect(InputStream source,
                           StringBuffer destination,
                           String encoding)
                    throws IOException
Transfers the data of an InputStream into a StringBuffer using the given encoding.

Parameters:
source -
destination -
encoding - - example: "utf-8"
Throws:
IOException
See Also:
Charset

connect

public static void connect(StringBuffer source,
                           OutputStream destination,
                           String encoding)
                    throws IOException
Transfers the data of a StringBuffer into an OutputStream.

Parameters:
source -
destination -
encoding - , like "utf-8"
Throws:
IOException


Copyright © 2013. All Rights Reserved.