]> cygwin.com Git - cygwin-apps/setup.git/blame - compress_bz.h
Suggest URLs for updated setup based on build architecture
[cygwin-apps/setup.git] / compress_bz.h
CommitLineData
b24c88b3
RC
1/*
2 * Copyright (c) 2001, Robert Collins.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
11 *
12 * Written by Robert Collins <rbtcollins@hotmail.com>
13 *
14 */
15
c93bc6d0
MB
16#ifndef SETUP_COMPRESS_BZ_H
17#define SETUP_COMPRESS_BZ_H
b24c88b3 18
b16e07fc 19#include "compress.h"
b24c88b3 20
db04fc41 21#include <bzlib.h>
b24c88b3
RC
22
23class compress_bz:public compress
24{
25public:
26 /* assumes decompression */
27 compress_bz (io_stream *);
28 /* allows comp/decomp but this implementation only handles comp */
29 compress_bz (io_stream *, const char *);
30 /* read data (duh!) */
31 virtual ssize_t read (void *buffer, size_t len);
32 /* provide data to (double duh!) */
ca9506cc 33 virtual ssize_t write (const void *buffer, size_t len);
b24c88b3
RC
34 /* read data without removing it from the class's internal buffer */
35 virtual ssize_t peek (void *buffer, size_t len);
44d31ea0
CV
36 virtual off_t tell ();
37 virtual off_t seek (off_t where, io_stream_seek_t whence);
b24c88b3
RC
38 /* try guessing this one */
39 virtual int error ();
40 /* Find out the next stream name -
41 * ie for foo.tar.bz, at offset 0, next_file_name = foo.tar
42 * for foobar that is an compress, next_file_name is the next
43 * extractable filename.
44 */
45 virtual const char *next_file_name ()
46 {
47 return NULL;
48 };
26922cd2 49 virtual int set_mtime (time_t);
341988b9
RC
50 /* Use seek EOF, then tell (). get_size won't do this incase you are sucking dow
51 * over a WAN :} */
52 virtual size_t get_size () {return 0;};
b41c2908
CV
53 virtual time_t get_mtime ();
54 virtual mode_t get_mode ();
5bc84ff1 55 virtual void release_original (); /* give up ownership of original io_stream */
b24c88b3
RC
56 /* if you are still needing these hints... give up now! */
57 virtual ~ compress_bz ();
58private:
59 io_stream *original;
5bc84ff1 60 bool owns_original;
b24c88b3
RC
61 char peekbuf[512];
62 size_t peeklen;
63 int lasterr;
64 bz_stream strm;
65 int initialisedOk;
3e4ddc99 66 int endReached;
b24c88b3
RC
67 char buf[4096];
68 int writing;
387cb501 69 size_t position;
840e95c1 70 void init_state(void);
b24c88b3
RC
71};
72
c93bc6d0 73#endif /* SETUP_COMPRESS_BZ_H */
This page took 0.164196 seconds and 5 git commands to generate.