liquibase.util
Class StreamUtil
java.lang.Object
liquibase.util.StreamUtil
public class StreamUtil
- extends Object
Utilities for working with streams.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
lineSeparator
public static final String lineSeparator
StreamUtil
public StreamUtil()
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
getContentLength
public static long getContentLength(InputStream in)
throws IOException
- Throws:
IOException
getContentLength
public static long getContentLength(Reader reader)
throws IOException
- Throws:
IOException
closeQuietly
public static void closeQuietly(Reader input)
closeQuietly
public static void closeQuietly(InputStream input)
closeQuietly
public static void closeQuietly(Closeable input)
openStream
public static InputStream openStream(String path,
Boolean relativeToChangelogFile,
ChangeSet changeSet,
ResourceAccessor resourceAccessor)
throws IOException
- Throws:
IOException
Copyright © 2014 Liquibase.org. All Rights Reserved.