liquibase.util
Class StreamUtil

java.lang.Object
  extended by liquibase.util.StreamUtil

public class StreamUtil
extends Object

Utilities for working with streams.


Field Summary
static String lineSeparator
           
 
Constructor Summary
StreamUtil()
           
 
Method Summary
static void copy(InputStream inputStream, OutputStream outputStream)
           
static String getLineSeparator()
           
static String getReaderContents(Reader reader)
          Reads all the characters into a String.
static String getStreamContents(InputStream ins)
          Reads a stream until the end of file into a String and uses the machines default encoding to convert to characters the bytes from the Stream.
static String getStreamContents(InputStream ins, String charsetName)
          Reads a stream until the end of file into a String and uses the machines default encoding to convert to characters the bytes from the Stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lineSeparator

public static final String lineSeparator
Constructor Detail

StreamUtil

public StreamUtil()
Method Detail

getLineSeparator

public static String getLineSeparator()

getStreamContents

public static String getStreamContents(InputStream ins)
                                throws IOException
Reads a stream until the end of file into a String and uses the machines default encoding to convert to characters the bytes from the Stream.

Parameters:
ins - The InputStream to read.
Returns:
The contents of the input stream as a String
Throws:
IOException - If there is an error reading the stream.

getStreamContents

public static String getStreamContents(InputStream ins,
                                       String charsetName)
                                throws IOException
Reads a stream until the end of file into a String and uses the machines default encoding to convert to characters the bytes from the Stream.

Parameters:
ins - The InputStream to read.
charsetName - The name of a supported charset
Returns:
The contents of the input stream as a String
Throws:
IOException - If there is an error reading the stream.

getReaderContents

public static String getReaderContents(Reader reader)
                                throws IOException
Reads all the characters into a String.

Parameters:
reader - The Reader to read.
Returns:
The contents of the input stream as a String
Throws:
IOException - If there is an error reading the stream.

copy

public static void copy(InputStream inputStream,
                        OutputStream outputStream)
                 throws IOException
Throws:
IOException


Copyright © 2004-2011 Liquibase.org. All Rights Reserved.