net.sf.samtools.util
Class TempStreamFactory

java.lang.Object
  extended by net.sf.samtools.util.TempStreamFactory

public class TempStreamFactory
extends Object

Factory class for wrapping input and output streams for temporary files. If available, Snappy is used to compress output files. Therefore, if a temporary output file is written with an output stream obtained from this class, it must be read by an input stream created by this class, otherwise a file written with compression will not be read with decompression.


Constructor Summary
TempStreamFactory()
           
 
Method Summary
 InputStream wrapTempInputStream(InputStream inputStream, int bufferSize)
          Wrap the given InputStream in a SnappyInputStream if available.
 OutputStream wrapTempOutputStream(OutputStream outputStream, int bufferSize)
          Wrap the given OutputStream in a SnappyOutputStream if available.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TempStreamFactory

public TempStreamFactory()
Method Detail

wrapTempInputStream

public InputStream wrapTempInputStream(InputStream inputStream,
                                       int bufferSize)
Wrap the given InputStream in a SnappyInputStream if available.

Returns:
If Snappy is available, a SnappyInputStream wrapping inputStream. If not, and bufferSize > 0, a BufferedInputStream. Otherwise inputStream is returned.

wrapTempOutputStream

public OutputStream wrapTempOutputStream(OutputStream outputStream,
                                         int bufferSize)
Wrap the given OutputStream in a SnappyOutputStream if available.

Returns:
If Snappy is available, a SnappyOutputStream wrapping outputStream. If not, and bufferSize > 0, a BufferedOutputStream. Otherwise outputStream is returned.