comparison java/src/java/util/zip/InflaterInputStream.d @ 0:6dd524f61e62

add dwt win and basic java stuff
author Frank Benoit <benoit@tionex.de>
date Mon, 02 Mar 2009 14:44:16 +0100
parents
children 2847134a5fc0
comparison
equal deleted inserted replaced
-1:000000000000 0:6dd524f61e62
1 /**
2 * Authors: Frank Benoit <keinfarbton@googlemail.com>
3 */
4 module java.util.zip.InflaterInputStream;
5
6 public import java.io.InputStream;
7 import java.lang.all;
8 import tango.io.Stdout;
9 import tango.io.compress.ZlibStream;
10 version(Windows){
11 version(build){
12 pragma(link,"zlib");
13 }
14 }
15 version(TANGOSVN){
16 import tango.io.device.Conduit;
17 } else {
18 import tango.io.Conduit;
19 }
20
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 void[] load (void[] dst = null) {
34 return Conduit.load (this, dst);
35 }
36
37 tango.io.model.IConduit.InputStream clear (){
38 return this;
39 }
40
41 tango.io.model.IConduit.IConduit conduit (){
42 return null;
43 }
44
45 void close (){
46 istr.close();
47 }
48 tango.io.model.IConduit.InputStream input (){
49 return null;
50 }
51 long seek (long offset, Anchor anchor = Anchor.Begin){
52 return 0;
53 }
54 }
55
56 public class InflaterInputStream : java.io.InputStream.InputStream {
57
58 alias java.io.InputStream.InputStream.read read;
59 alias java.io.InputStream.InputStream.skip skip;
60 alias java.io.InputStream.InputStream.available available;
61 alias java.io.InputStream.InputStream.close close;
62 alias java.io.InputStream.InputStream.mark mark;
63 alias java.io.InputStream.InputStream.reset reset;
64 alias java.io.InputStream.InputStream.markSupported markSupported;
65
66 protected byte[] buf;
67 protected int len;
68 package bool usesDefaultInflater = false;
69
70 ZlibInput tangoIstr;
71
72 public this ( java.io.InputStream.InputStream istr ){
73 tangoIstr = new ZlibInput( new InputStreamWrapper(istr ));
74 }
75
76 public int read(){
77 ubyte[1] data;
78 uint res = tangoIstr.read( data );
79 if( res !is 1 ){
80 return data[0] & 0xFF;
81 }
82 return -1;
83 }
84
85 public int read( byte[] b, int off, int len ){
86 implMissing( __FILE__, __LINE__ );
87 return 0;
88 }
89
90 public int available(){
91 implMissing( __FILE__, __LINE__ );
92 return 0;
93 }
94
95 public long skip( long n ){
96 implMissing( __FILE__, __LINE__ );
97 return 0L;
98 }
99
100 public void close(){
101 implMissing( __FILE__, __LINE__ );
102 }
103
104 public void fill(){
105 implMissing( __FILE__, __LINE__ );
106 }
107
108 public bool markSupported(){
109 implMissing( __FILE__, __LINE__ );
110 return false;
111 }
112
113 public synchronized void mark( int readlimit ){
114 implMissing( __FILE__, __LINE__ );
115 }
116
117 public synchronized void reset(){
118 implMissing( __FILE__, __LINE__ );
119 }
120 }
121
122