org.clazzes.jdbc2xml.helper
Class StreamHelper

java.lang.Object
  extended by org.clazzes.jdbc2xml.helper.StreamHelper

public abstract class StreamHelper
extends java.lang.Object

Static functions for setting up compressed/uncompressed streams.

Author:
wglas

Constructor Summary
StreamHelper()
           
 
Method Summary
static java.io.InputStream makeInputStream(java.lang.String filename)
          Creates an input stream, which possibly does decompression based on the extension of the given filename.
static java.io.OutputStream makeOutpuStream(java.lang.String filename, java.lang.Integer compression)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamHelper

public StreamHelper()
Method Detail

makeInputStream

public static java.io.InputStream makeInputStream(java.lang.String filename)
                                           throws java.io.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:
java.io.IOException - If the file does not exist or the headers of compressed file are invalid.

makeOutpuStream

public static java.io.OutputStream makeOutpuStream(java.lang.String filename,
                                                   java.lang.Integer compression)
                                            throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2010. All Rights Reserved.