35 #include <sys/types.h>
37 #define BGZF_BLOCK_SIZE 0xff00 // make sure compressBound(BGZF_BLOCK_SIZE) < BGZF_MAX_BLOCK_SIZE
38 #define BGZF_MAX_BLOCK_SIZE 0x10000
40 #define BGZF_ERR_ZLIB 1
41 #define BGZF_ERR_HEADER 2
43 #define BGZF_ERR_MISUSE 8
62 #ifndef HTS_BGZF_TYPEDEF
64 #define HTS_BGZF_TYPEDEF
68 #define KSTRING_T kstring_t
98 #define bgzf_fdopen(fd, mode) bgzf_dopen((fd), (mode)) // for backward compatibility
174 #define bgzf_tell(fp) (((fp)->block_address << 16) | ((fp)->block_offset & 0xFFFF))
253 int bgzf_mt(
BGZF *fp,
int n_threads,
int n_sub_blks);
void * cache
Definition: bgzf.h:55
struct bgzf_mtaux_t * mt
Definition: bgzf.h:57
int64_t bgzf_seek(BGZF *fp, int64_t pos, int whence)
Definition: bgzf.c:846
int bgzf_index_dump(BGZF *fp, const char *bname, const char *suffix)
Definition: bgzf.c:967
ssize_t bgzf_raw_write(BGZF *fp, const void *data, size_t length)
Definition: bgzf.c:790
int bgzf_flush_try(BGZF *fp, ssize_t size)
Definition: bgzf.c:761
int cache_size
Definition: bgzf.h:51
void bgzf_set_cache_size(BGZF *fp, int size)
Definition: bgzf.c:828
int is_compressed
Definition: bgzf.h:50
bgzidx_t * idx
Definition: bgzf.h:58
size_t l
Definition: bgzf.h:70
z_stream * gz_stream
Definition: bgzf.h:60
int is_gzip
Definition: bgzf.h:50
int compress_level
Definition: bgzf.h:50
int bgzf_getc(BGZF *fp)
Definition: bgzf.c:879
int is_be
Definition: bgzf.h:50
struct __kstring_t kstring_t
int block_length
Definition: bgzf.h:52
BGZF * bgzf_dopen(int fd, const char *mode)
Definition: bgzf.c:190
int bgzf_useek(BGZF *fp, long uoffset, int where)
Definition: bgzf.c:1068
int is_write
Definition: bgzf.h:50
int bgzf_read_block(BGZF *fp)
Definition: bgzf.c:418
BGZF * bgzf_open(const char *path, const char *mode)
Definition: bgzf.c:168
int bgzf_is_bgzf(const char *fn)
Definition: bgzf.c:867
int block_offset
Definition: bgzf.h:52
BGZF * bgzf_hopen(struct hFILE *fp, const char *mode)
Definition: bgzf.c:212
int errcode
Definition: bgzf.h:50
int bgzf_mt(BGZF *fp, int n_threads, int n_sub_blks)
Definition: bgzf.c:628
size_t m
Definition: bgzf.h:70
#define str(x)
Definition: sam.c:66
ssize_t bgzf_write(BGZF *fp, const void *data, size_t length)
Definition: bgzf.c:767
int bgzf_index_load(BGZF *fp, const char *bname, const char *suffix)
Definition: bgzf.c:1017
int idx_build_otf
Definition: bgzf.h:59
int bgzf_flush(BGZF *fp)
Definition: bgzf.c:735
void * compressed_block
Definition: bgzf.h:54
void * uncompressed_block
Definition: bgzf.h:54
int bgzf_check_EOF(BGZF *fp)
Definition: bgzf.c:833
char * s
Definition: bgzf.h:71
int64_t uncompressed_address
Definition: bgzf.h:53
ssize_t bgzf_read(BGZF *fp, void *data, size_t length)
Definition: bgzf.c:546
int bgzf_getline(BGZF *fp, int delim, kstring_t *str)
Definition: bgzf.c:900
int bgzf_close(BGZF *fp)
Definition: bgzf.c:795
long bgzf_utell(BGZF *fp)
Definition: bgzf.c:1119
int bgzf_index_build_init(BGZF *fp)
Definition: bgzf.c:943
struct hFILE * fp
Definition: bgzf.h:56
ssize_t bgzf_raw_read(BGZF *fp, void *data, size_t length)
Definition: bgzf.c:575
int64_t block_address
Definition: bgzf.h:53