Mercurial > projects > dwt-win
annotate dwt/dwthelper/InflaterInputStream.d @ 339:210994f12c4c
Fixes for dmd 1.041 and tango 0.99.8
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 28 Mar 2009 03:12:07 +0100 |
parents | ecb375fd8f95 |
children |
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 } |
339
210994f12c4c
Fixes for dmd 1.041 and tango 0.99.8
Frank Benoit <benoit@tionex.de>
parents:
338
diff
changeset
|
15 import tango.io.device.Conduit; |
264
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 } | |
338 | 29 |
30 IOStream flush () { | |
31 return this; | |
32 } | |
33 | |
34 void[] load ( size_t max = -1 ) { | |
35 return Conduit.load (this, max); | |
248 | 36 } |
37 | |
38 tango.io.model.IConduit.InputStream clear (){ | |
39 return this; | |
40 } | |
41 | |
42 tango.io.model.IConduit.IConduit conduit (){ | |
43 return null; | |
44 } | |
45 | |
46 void close (){ | |
47 istr.close(); | |
48 } | |
332
1ee938a6e02e
Tango updates, removing trace prints and added prints via Logger
Frank Benoit <benoit@tionex.de>
parents:
308
diff
changeset
|
49 tango.io.model.IConduit.InputStream input (){ |
1ee938a6e02e
Tango updates, removing trace prints and added prints via Logger
Frank Benoit <benoit@tionex.de>
parents:
308
diff
changeset
|
50 return null; |
1ee938a6e02e
Tango updates, removing trace prints and added prints via Logger
Frank Benoit <benoit@tionex.de>
parents:
308
diff
changeset
|
51 } |
1ee938a6e02e
Tango updates, removing trace prints and added prints via Logger
Frank Benoit <benoit@tionex.de>
parents:
308
diff
changeset
|
52 long seek (long offset, Anchor anchor = Anchor.Begin){ |
1ee938a6e02e
Tango updates, removing trace prints and added prints via Logger
Frank Benoit <benoit@tionex.de>
parents:
308
diff
changeset
|
53 return 0; |
1ee938a6e02e
Tango updates, removing trace prints and added prints via Logger
Frank Benoit <benoit@tionex.de>
parents:
308
diff
changeset
|
54 } |
248 | 55 } |
0 | 56 |
57 public class InflaterInputStream : dwt.dwthelper.InputStream.InputStream { | |
58 | |
59 alias dwt.dwthelper.InputStream.InputStream.read read; | |
60 alias dwt.dwthelper.InputStream.InputStream.skip skip; | |
61 alias dwt.dwthelper.InputStream.InputStream.available available; | |
62 alias dwt.dwthelper.InputStream.InputStream.close close; | |
63 alias dwt.dwthelper.InputStream.InputStream.mark mark; | |
64 alias dwt.dwthelper.InputStream.InputStream.reset reset; | |
65 alias dwt.dwthelper.InputStream.InputStream.markSupported markSupported; | |
66 | |
67 protected byte[] buf; | |
68 protected int len; | |
69 package bool usesDefaultInflater = false; | |
70 | |
248 | 71 ZlibInput tangoIstr; |
72 | |
0 | 73 public this ( dwt.dwthelper.InputStream.InputStream istr ){ |
248 | 74 tangoIstr = new ZlibInput( new InputStreamWrapper(istr )); |
0 | 75 } |
76 | |
77 public int read(){ | |
248 | 78 ubyte[1] data; |
79 uint res = tangoIstr.read( data ); | |
80 if( res !is 1 ){ | |
81 return data[0] & 0xFF; | |
82 } | |
83 return -1; | |
0 | 84 } |
85 | |
86 public int read( byte[] b, int off, int len ){ | |
87 implMissing( __FILE__, __LINE__ ); | |
88 return 0; | |
89 } | |
90 | |
91 public int available(){ | |
92 implMissing( __FILE__, __LINE__ ); | |
93 return 0; | |
94 } | |
95 | |
96 public long skip( long n ){ | |
97 implMissing( __FILE__, __LINE__ ); | |
98 return 0L; | |
99 } | |
100 | |
101 public void close(){ | |
102 implMissing( __FILE__, __LINE__ ); | |
103 } | |
104 | |
105 public void fill(){ | |
106 implMissing( __FILE__, __LINE__ ); | |
107 } | |
108 | |
109 public bool markSupported(){ | |
110 implMissing( __FILE__, __LINE__ ); | |
111 return false; | |
112 } | |
113 | |
114 public synchronized void mark( int readlimit ){ | |
115 implMissing( __FILE__, __LINE__ ); | |
116 } | |
117 | |
118 public synchronized void reset(){ | |
119 implMissing( __FILE__, __LINE__ ); | |
120 } | |
121 } | |
122 | |
123 |