2 // Copyright (C) 2001 Mike Krueger
\r
4 // This program is free software; you can redistribute it and/or
\r
5 // modify it under the terms of the GNU General Public License
\r
6 // as published by the Free Software Foundation; either version 2
\r
7 // of the License, or (at your option) any later version.
\r
9 // This program is distributed in the hope that it will be useful,
\r
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
12 // GNU General Public License for more details.
\r
14 // You should have received a copy of the GNU General Public License
\r
15 // along with this program; if not, write to the Free Software
\r
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
\r
18 // Linking this library statically or dynamically with other modules is
\r
19 // making a combined work based on this library. Thus, the terms and
\r
20 // conditions of the GNU General Public License cover the whole
\r
23 // As a special exception, the copyright holders of this library give you
\r
24 // permission to link this library with independent modules to produce an
\r
25 // executable, regardless of the license terms of these independent
\r
26 // modules, and to copy and distribute the resulting executable under
\r
27 // terms of your choice, provided that you also meet, for each linked
\r
28 // independent module, the terms and conditions of the license of that
\r
29 // module. An independent module is a module which is not derived from
\r
30 // or based on this library. If you modify this library, you may extend
\r
31 // this exception to your version of the library, but you are not
\r
32 // obligated to do so. If you do not wish to do so, delete this
\r
33 // exception statement from your version.
\r
38 namespace ICSharpCode.SharpZipLib.BZip2
\r
42 /// Does all the compress and decompress pre-operation stuff.
\r
43 /// Sets up the streams and file header characters.
\r
44 /// Uses multiply overloaded methods to call for the compress/decompress.
\r
46 public sealed class BZip2
\r
48 public static void Decompress(Stream instream, Stream outstream)
\r
50 System.IO.Stream bos = outstream;
\r
51 System.IO.Stream bis = instream;
\r
52 BZip2InputStream bzis = new BZip2InputStream(bis);
\r
53 int ch = bzis.ReadByte();
\r
55 bos.WriteByte((byte)ch);
\r
56 ch = bzis.ReadByte();
\r
61 public static void Compress(Stream instream, Stream outstream, int blockSize)
\r
63 System.IO.Stream bos = outstream;
\r
64 System.IO.Stream bis = instream;
\r
65 int ch = bis.ReadByte();
\r
66 BZip2OutputStream bzos = new BZip2OutputStream(bos, blockSize);
\r
68 bzos.WriteByte((byte)ch);
\r
69 ch = bis.ReadByte();
\r
76 /* derived from a file which contained this license :
\r
77 * Copyright (c) 1999-2001 Keiron Liddle, Aftex Software
\r
79 * This library is free software; you can redistribute it and/or
\r
80 * modify it under the terms of the GNU Lesser General Public
\r
81 * License as published by the Free Software Foundation; either
\r
82 * version 2.1 of the License, or (at your option) any later version.
\r
84 * This library is distributed in the hope that it will be useful,
\r
85 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
86 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
\r
87 * Lesser General Public License for more details.
\r