Mercurial > projects > dwt2
comparison base/src/java/util/zip/InflaterInputStream.d @ 27:1bf55a6eb092
Renamed java tree to base
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 21 Mar 2009 11:33:57 +0100 |
parents | java/src/java/util/zip/InflaterInputStream.d@9b96950f2c3c |
children | f05e6e8b2f2d |
comparison
equal
deleted
inserted
replaced
26:f589fc20a5f9 | 27:1bf55a6eb092 |
---|---|
1 /** | |
2 * Authors: Frank Benoit <keinfarbton@googlemail.com> | |
3 */ | |
4 module java.util.zip.InflaterInputStream; | |
5 | |
6 import java.lang.all; | |
7 import java.io.InputStream; | |
8 version(Tango){ | |
9 import tango.io.compress.ZlibStream; | |
10 import tango.io.device.Conduit; | |
11 version(Windows){ | |
12 version(build){ | |
13 pragma(link,"zlib"); | |
14 } | |
15 } | |
16 } else { // Phobos | |
17 import std.zlib; | |
18 } | |
19 | |
20 version(Tango){ | |
21 class InputStreamWrapper : tango.io.model.IConduit.InputStream { | |
22 | |
23 java.io.InputStream.InputStream istr; | |
24 | |
25 this( java.io.InputStream.InputStream istr ){ | |
26 this.istr = istr; | |
27 } | |
28 | |
29 uint read (void[] dst){ | |
30 int res = istr.read( cast(byte[])dst ); | |
31 return res; | |
32 } | |
33 | |
34 tango.io.model.IConduit.IConduit conduit (){ | |
35 implMissing(__FILE__,__LINE__); | |
36 return null; | |
37 } | |
38 | |
39 void close (){ | |
40 istr.close(); | |
41 } | |
42 tango.io.model.IConduit.InputStream input (){ | |
43 implMissing(__FILE__,__LINE__); | |
44 return null; | |
45 } | |
46 long seek (long offset, Anchor anchor = Anchor.Begin){ | |
47 implMissing(__FILE__,__LINE__); | |
48 return 0; | |
49 } | |
50 void[] load (size_t max = -1){ | |
51 implMissing(__FILE__,__LINE__); | |
52 return null; | |
53 } | |
54 IOStream flush (){ | |
55 implMissing(__FILE__,__LINE__); | |
56 return null; | |
57 } | |
58 } | |
59 } else { // Phobos | |
60 } | |
61 | |
62 | |
63 public class InflaterInputStream : java.io.InputStream.InputStream { | |
64 | |
65 alias java.io.InputStream.InputStream.read read; | |
66 alias java.io.InputStream.InputStream.skip skip; | |
67 alias java.io.InputStream.InputStream.available available; | |
68 alias java.io.InputStream.InputStream.close close; | |
69 alias java.io.InputStream.InputStream.mark mark; | |
70 alias java.io.InputStream.InputStream.reset reset; | |
71 alias java.io.InputStream.InputStream.markSupported markSupported; | |
72 | |
73 protected byte[] buf; | |
74 protected int len; | |
75 package bool usesDefaultInflater = false; | |
76 | |
77 version(Tango){ | |
78 ZlibInput tangoIstr; | |
79 } else { // Phobos | |
80 } | |
81 | |
82 public this ( java.io.InputStream.InputStream istr ){ | |
83 version(Tango){ | |
84 tangoIstr = new ZlibInput( new InputStreamWrapper(istr )); | |
85 } else { // Phobos | |
86 implMissing( __FILE__, __LINE__ ); | |
87 } | |
88 } | |
89 | |
90 public int read(){ | |
91 version(Tango){ | |
92 ubyte[1] data; | |
93 uint res = tangoIstr.read( data ); | |
94 if( res !is 1 ){ | |
95 return data[0] & 0xFF; | |
96 } | |
97 return -1; | |
98 } else { // Phobos | |
99 implMissing( __FILE__, __LINE__ ); | |
100 return -1; | |
101 } | |
102 } | |
103 | |
104 public int read( byte[] b, int off, int len ){ | |
105 implMissing( __FILE__, __LINE__ ); | |
106 return 0; | |
107 } | |
108 | |
109 public int available(){ | |
110 implMissing( __FILE__, __LINE__ ); | |
111 return 0; | |
112 } | |
113 | |
114 public long skip( long n ){ | |
115 implMissing( __FILE__, __LINE__ ); | |
116 return 0L; | |
117 } | |
118 | |
119 public void close(){ | |
120 implMissing( __FILE__, __LINE__ ); | |
121 } | |
122 | |
123 public void fill(){ | |
124 implMissing( __FILE__, __LINE__ ); | |
125 } | |
126 | |
127 public bool markSupported(){ | |
128 implMissing( __FILE__, __LINE__ ); | |
129 return false; | |
130 } | |
131 | |
132 public synchronized void mark( int readlimit ){ | |
133 implMissing( __FILE__, __LINE__ ); | |
134 } | |
135 | |
136 public synchronized void reset(){ | |
137 implMissing( __FILE__, __LINE__ ); | |
138 } | |
139 } | |
140 | |
141 |