/usr/include/kmer/util/bzipBuffer.H is in libkmer-dev 0~20150903+r2013-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | #ifndef BZIP_BUFFER_H
#define BZIP_BUFFER_H
#include <stdio.h>
#include <stdlib.h>
#include <bzlib.h>
#include "util.h"
class bzipBuffer {
public:
bzipBuffer(const char *filename, uint32 bufferMax = 32 * 1024);
~bzipBuffer();
bool eof(void);
bool next(void);
char get(void);
char getnext(void);
bool seek(off_t pos);
size_t read(char *buf, size_t len); // read the next len bytes into the user buffer buf
off_t tell(void);
private:
void fillBuffer(void);
void init(int fileptr, const char *filename, uint32 bufferMax);
char *_filename;
int _file;
off_t _filePos;
bool _eof;
uint32 _bzip2bufferMax;
uint32 _bzip2inPos;
uint32 _bzip2outPos;
char *_bzip2in;
char *_bzip2out;
bool _bzip2streamEnd;
bz_stream _bzip2stream;
};
inline
bool
bzipBuffer::eof(void) {
return(_eof);
}
inline
bool
bzipBuffer::next(void) {
if (_eof)
return(true);
_bzip2outPos++;
_filePos++;
if (_bzip2outPos >= _bzip2stream.avail_out)
fillBuffer();
return(_eof);
}
inline
char
bzipBuffer::get(void) {
return(_bzip2out[_bzip2outPos]);
}
inline
char
bzipBuffer::getnext(void) {
char x = _bzip2out[_bzip2outPos];
next();
return(x);
}
inline
off_t
bzipBuffer::tell(void) {
return(_filePos);
}
#endif // BZIP_BUFFER_H
|