Write _length_ bytes from _data_ to the file, the index will be used to decide the amount of uncompressed data to be written to each bgzip block. If no I/O errors occur, the complete _length_ bytes will be written (or queued for writing). @param fp BGZF file handler @param data data array to write @param length size of data to write @return number of bytes written (i.e., _length_); negative on error
Check if the BGZF end-of-file (EOF) marker is present
Close the BGZF and free all associated resources.
Compress a single BGZF block.
Return the file's compression format
Open an existing file descriptor for reading or writing.
Write the data in the buffer to the file.
Flush the file if the remaining buffer size is smaller than _size_ @return 0 if flushing succeeded or was not needed; negative on error
Read one byte from a BGZF file. It is faster than bgzf_read() @param fp BGZF file handler @return byte read; -1 on end-of-file or error
Read one line from a BGZF file. It is faster than bgzf_getc()
Open an existing hFILE stream for reading or writing.
Tell BGZF to build index while compressing.
@param fp BGZF file handler @param bname base name @param suffix suffix to add to bname (can be NULL) @return 0 on success and -1 on error.
@param fp BGZF file handle @param idx hFILE to write to @param name file name (for error reporting only, can be NULL) @return 0 on success and -1 on error.
@param fp BGZF file handler @param bname base name @param suffix suffix to add to bname (can be NULL) @return 0 on success and -1 on error.
@param fp BGZF file handle @param idx hFILE to read from @param name file name (for error reporting only; can be NULL) @return 0 on success and -1 on error.
Check if a file is in the BGZF format
Enable multi-threading (only effective when the library was compiled with -DBGZF_MT)
Open the specified file for reading or writing.
Returns the next byte in the file without consuming it. @param fp BGZF file handler @return -1 on EOF, -2 on error, otherwise the unsigned byte value.
Read up to _length_ bytes directly from the underlying stream without decompressing. Bypasses BGZF blocking, so must be used with care in specialised circumstances only.
Write _length_ bytes directly to the underlying stream without compressing. Bypasses BGZF blocking, so must be used with care in specialised circumstances only.
Read up to _length_ bytes from the file storing into _data_.
Read the next BGZF block.
Set the file to read from the location specified by _pos_.
Set the cache size. Only effective when compiled with -DBGZF_CACHE.
Return a virtual file pointer to the current location in the file. No interpretation of the value should be made, other than a subsequent call to bgzf_seek can be used to position the file at the same point. Return value is non-negative on success.
Enable multi-threading (when compiled with -DBGZF_MT) via a shared thread pool. This means both encoder and decoder can balance usage across a single pool of worker jobs.
Position BGZF at the uncompressed offset
Position in uncompressed BGZF
Write _length_ bytes from _data_ to the file. If no I/O errors occur, the complete _length_ bytes will be written (or queued for writing).
@file htslib/bgzf.h Low-level routines for direct BGZF operations.