public class BlockCompressedOutputStream extends java.io.OutputStream implements LocationAware
Constructor and Description |
---|
BlockCompressedOutputStream(java.io.File file)
Uses default compression level, which is 5 unless changed by setDefaultCompressionLevel
|
BlockCompressedOutputStream(java.io.File file,
int compressionLevel)
Prepare to compress at the given compression level
|
BlockCompressedOutputStream(java.io.OutputStream os,
java.io.File file)
Constructors that take output streams
file may be null
|
BlockCompressedOutputStream(java.io.OutputStream os,
java.io.File file,
int compressionLevel) |
BlockCompressedOutputStream(java.lang.String filename)
Uses default compression level, which is 5 unless changed by setDefaultCompressionLevel
|
BlockCompressedOutputStream(java.lang.String filename,
int compressionLevel)
Prepare to compress at the given compression level
|
Modifier and Type | Method and Description |
---|---|
void |
close()
close() must be called in order to flush any remaining buffered bytes.
|
void |
flush()
WARNING: flush() affects the output format, because it causes the current contents of uncompressedBuffer
to be compressed and written, even if it isn't full.
|
static int |
getDefaultCompressionLevel() |
long |
getFilePointer()
Encode virtual file pointer
Upper 48 bits is the byte offset into the compressed stream of a block.
|
long |
getPosition()
The current offset, in bytes, of this stream/writer/file.
|
static BlockCompressedOutputStream |
maybeBgzfWrapOutputStream(java.io.File location,
java.io.OutputStream output) |
static void |
setDefaultCompressionLevel(int compressionLevel)
Sets the GZip compression level for subsequent BlockCompressedOutputStream object creation
that do not specify the compression level.
|
void |
write(byte[] bytes)
Writes b.length bytes from the specified byte array to this output stream.
|
void |
write(byte[] bytes,
int startIndex,
int numBytes)
Writes len bytes from the specified byte array starting at offset off to this output stream.
|
void |
write(int bite)
Writes the specified byte to this output stream.
|
public BlockCompressedOutputStream(java.lang.String filename)
public BlockCompressedOutputStream(java.io.File file)
public BlockCompressedOutputStream(java.lang.String filename, int compressionLevel)
compressionLevel
- 1 <= compressionLevel <= 9public BlockCompressedOutputStream(java.io.File file, int compressionLevel)
compressionLevel
- 1 <= compressionLevel <= 9public BlockCompressedOutputStream(java.io.OutputStream os, java.io.File file)
public BlockCompressedOutputStream(java.io.OutputStream os, java.io.File file, int compressionLevel)
public static void setDefaultCompressionLevel(int compressionLevel)
compressionLevel
- 1 <= compressionLevel <= 9public static int getDefaultCompressionLevel()
public static BlockCompressedOutputStream maybeBgzfWrapOutputStream(java.io.File location, java.io.OutputStream output)
location
- May be null. Used for error messages, and for checking file termination.output
- May or not already be a BlockCompressedOutputStream.public void write(byte[] bytes) throws java.io.IOException
write
in class java.io.OutputStream
bytes
- the datajava.io.IOException
public void write(byte[] bytes, int startIndex, int numBytes) throws java.io.IOException
write
in class java.io.OutputStream
bytes
- the datastartIndex
- the start offset in the datanumBytes
- the number of bytes to writejava.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
java.io.IOException
public void write(int bite) throws java.io.IOException
write
in class java.io.OutputStream
bite
- java.io.IOException
public long getFilePointer()
public long getPosition()
LocationAware
getPosition
in interface LocationAware