org.clazzes.jdbc2xml.helper
Class StreamHelper
java.lang.Object
org.clazzes.jdbc2xml.helper.StreamHelper
public abstract class StreamHelper
- extends Object
Static functions for setting up compressed/uncompressed streams.
- Author:
- wglas
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StreamHelper
public StreamHelper()
makeInputStream
public static InputStream makeInputStream(String filename)
throws IOException
- Creates an input stream, which possibly does decompression based on the
extension of the given filename.
- Parameters:
filename
- The name of the file to open.
- Returns:
- A
GZIPInputStream
, if the filename ends with .gz
,
a BZip2InputStream
, if the filename ends with .bz2
,
System.in
if filename is null or
a bare FileInputStream
in all other situations.
- Throws:
IOException
- If the file does not exist or the headers of compressed
file are invalid.
makeOutpuStream
public static OutputStream makeOutpuStream(String filename,
Integer compression)
throws IOException
- Throws:
IOException
Copyright © 2012. All Rights Reserved.