# Class TempStreamFactory

java.lang.Object
htsjdk.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

Constructors
Constructor
Description
`TempStreamFactory()`

## Method Summary

Modifier and Type
Method
Description
`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 Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### TempStreamFactory

public TempStreamFactory()

## Method Details

### 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.