Show deprecation warning for Windows versions 6.1 and 6.2
[cygwin-setup.git] / compress_bz.h
bloba7e865a0d55b46d1347588d28dca285f4fe918a4
1 /*
2 * Copyright (c) 2001, Robert Collins.
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.
9 * A copy of the GNU General Public License can be found at
10 * http://www.gnu.org/
12 * Written by Robert Collins <rbtcollins@hotmail.com>
16 #ifndef SETUP_COMPRESS_BZ_H
17 #define SETUP_COMPRESS_BZ_H
19 #include "compress.h"
21 #include <bzlib.h>
23 class compress_bz:public compress
25 public:
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!) */
33 virtual ssize_t write (const void *buffer, size_t len);
34 /* read data without removing it from the class's internal buffer */
35 virtual ssize_t peek (void *buffer, size_t len);
36 virtual long tell ();
37 virtual int seek (long where, io_stream_seek_t whence);
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.
45 virtual const char *next_file_name ()
47 return NULL;
49 virtual int set_mtime (time_t);
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;};
53 virtual time_t get_mtime ();
54 virtual mode_t get_mode ();
55 virtual void release_original (); /* give up ownership of original io_stream */
56 /* if you are still needing these hints... give up now! */
57 virtual ~ compress_bz ();
58 private:
59 io_stream *original;
60 bool owns_original;
61 char peekbuf[512];
62 size_t peeklen;
63 int lasterr;
64 bz_stream strm;
65 int initialisedOk;
66 int endReached;
67 char buf[4096];
68 int writing;
69 size_t position;
70 void init_state(void);
73 #endif /* SETUP_COMPRESS_BZ_H */