Mercurial > projects > dwt-win
annotate dwt/dwthelper/InflaterInputStream.d @ 264:a63e2cd5485e
Removed version=TANGOSVN for release 0.99.7
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 26 Jul 2008 02:48:20 +0200 |
parents | f6169caa2e05 |
children | 8d53428f9be0 |
rev | line source |
---|---|
0 | 1 /** |
2 * Authors: Frank Benoit <keinfarbton@googlemail.com> | |
3 */ | |
4 module dwt.dwthelper.InflaterInputStream; | |
5 | |
6 public import dwt.dwthelper.InputStream; | |
7 import dwt.dwthelper.utils; | |
248 | 8 import tango.io.Stdout; |
9 import tango.io.compress.ZlibStream; | |
251
f6169caa2e05
Fix: add pragma link for zlib on windows.
Frank Benoit <benoit@tionex.de>
parents:
248
diff
changeset
|
10 version(Windows){ |
f6169caa2e05
Fix: add pragma link for zlib on windows.
Frank Benoit <benoit@tionex.de>
parents:
248
diff
changeset
|
11 version(build){ |
f6169caa2e05
Fix: add pragma link for zlib on windows.
Frank Benoit <benoit@tionex.de>
parents:
248
diff
changeset
|
12 pragma(link,"zlib"); |
f6169caa2e05
Fix: add pragma link for zlib on windows.
Frank Benoit <benoit@tionex.de>
parents:
248
diff
changeset
|
13 } |
f6169caa2e05
Fix: add pragma link for zlib on windows.
Frank Benoit <benoit@tionex.de>
parents:
248
diff
changeset
|
14 } |
264
a63e2cd5485e
Removed version=TANGOSVN for release 0.99.7
Frank Benoit <benoit@tionex.de>
parents:
251
diff
changeset
|
15 import tango.io.Conduit; |
a63e2cd5485e
Removed version=TANGOSVN for release 0.99.7
Frank Benoit <benoit@tionex.de>
parents:
251
diff
changeset
|
16 |
248 | 17 class InputStreamWrapper : tango.io.model.IConduit.InputStream { |
18 | |
19 dwt.dwthelper.InputStream.InputStream istr; | |
20 | |
21 this( dwt.dwthelper.InputStream.InputStream istr ){ | |
22 this.istr = istr; | |
23 } | |
24 | |
25 uint read (void[] dst){ | |
26 int res = istr.read( cast(byte[])dst ); | |
27 return res; | |
28 } | |
29 void[] load (void[] dst = null) { | |
30 return Conduit.load (this, dst); | |
31 } | |
32 | |
33 tango.io.model.IConduit.InputStream clear (){ | |
34 return this; | |
35 } | |
36 | |
37 tango.io.model.IConduit.IConduit conduit (){ | |
38 return null; | |
39 } | |
40 | |
41 void close (){ | |
42 istr.close(); | |
43 } | |
44 } | |
0 | 45 |
46 public class InflaterInputStream : dwt.dwthelper.InputStream.InputStream { | |
47 | |
48 alias dwt.dwthelper.InputStream.InputStream.read read; | |
49 alias dwt.dwthelper.InputStream.InputStream.skip skip; | |
50 alias dwt.dwthelper.InputStream.InputStream.available available; | |
51 alias dwt.dwthelper.InputStream.InputStream.close close; | |
52 alias dwt.dwthelper.InputStream.InputStream.mark mark; | |
53 alias dwt.dwthelper.InputStream.InputStream.reset reset; | |
54 alias dwt.dwthelper.InputStream.InputStream.markSupported markSupported; | |
55 | |
56 protected byte[] buf; | |
57 protected int len; | |
58 package bool usesDefaultInflater = false; | |
59 | |
248 | 60 ZlibInput tangoIstr; |
61 | |
0 | 62 public this ( dwt.dwthelper.InputStream.InputStream istr ){ |
248 | 63 tangoIstr = new ZlibInput( new InputStreamWrapper(istr )); |
0 | 64 } |
65 | |
66 public int read(){ | |
248 | 67 ubyte[1] data; |
68 uint res = tangoIstr.read( data ); | |
69 if( res !is 1 ){ | |
70 return data[0] & 0xFF; | |
71 } | |
72 return -1; | |
0 | 73 } |
74 | |
75 public int read( byte[] b, int off, int len ){ | |
76 implMissing( __FILE__, __LINE__ ); | |
77 return 0; | |
78 } | |
79 | |
80 public int available(){ | |
81 implMissing( __FILE__, __LINE__ ); | |
82 return 0; | |
83 } | |
84 | |
85 public long skip( long n ){ | |
86 implMissing( __FILE__, __LINE__ ); | |
87 return 0L; | |
88 } | |
89 | |
90 public void close(){ | |
91 implMissing( __FILE__, __LINE__ ); | |
92 } | |
93 | |
94 public void fill(){ | |
95 implMissing( __FILE__, __LINE__ ); | |
96 } | |
97 | |
98 public bool markSupported(){ | |
99 implMissing( __FILE__, __LINE__ ); | |
100 return false; | |
101 } | |
102 | |
103 public synchronized void mark( int readlimit ){ | |
104 implMissing( __FILE__, __LINE__ ); | |
105 } | |
106 | |
107 public synchronized void reset(){ | |
108 implMissing( __FILE__, __LINE__ ); | |
109 } | |
110 } | |
111 | |
112 |