Mercurial > projects > dwt2
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/src/java/util/zip/InflaterInputStream.d Mon Mar 02 14:44:16 2009 +0100 @@ -0,0 +1,122 @@ +/** + * Authors: Frank Benoit <keinfarbton@googlemail.com> + */ +module java.util.zip.InflaterInputStream; + +public import java.io.InputStream; +import java.lang.all; +import tango.io.Stdout; +import tango.io.compress.ZlibStream; +version(Windows){ + version(build){ + pragma(link,"zlib"); + } +} +version(TANGOSVN){ + import tango.io.device.Conduit; +} else { + import tango.io.Conduit; +} + +class InputStreamWrapper : tango.io.model.IConduit.InputStream { + + java.io.InputStream.InputStream istr; + + this( java.io.InputStream.InputStream istr ){ + this.istr = istr; + } + + uint read (void[] dst){ + int res = istr.read( cast(byte[])dst ); + return res; + } + void[] load (void[] dst = null) { + return Conduit.load (this, dst); + } + + tango.io.model.IConduit.InputStream clear (){ + return this; + } + + tango.io.model.IConduit.IConduit conduit (){ + return null; + } + + void close (){ + istr.close(); + } + tango.io.model.IConduit.InputStream input (){ + return null; + } + long seek (long offset, Anchor anchor = Anchor.Begin){ + return 0; + } +} + +public class InflaterInputStream : java.io.InputStream.InputStream { + + alias java.io.InputStream.InputStream.read read; + alias java.io.InputStream.InputStream.skip skip; + alias java.io.InputStream.InputStream.available available; + alias java.io.InputStream.InputStream.close close; + alias java.io.InputStream.InputStream.mark mark; + alias java.io.InputStream.InputStream.reset reset; + alias java.io.InputStream.InputStream.markSupported markSupported; + + protected byte[] buf; + protected int len; + package bool usesDefaultInflater = false; + + ZlibInput tangoIstr; + + public this ( java.io.InputStream.InputStream istr ){ + tangoIstr = new ZlibInput( new InputStreamWrapper(istr )); + } + + public int read(){ + ubyte[1] data; + uint res = tangoIstr.read( data ); + if( res !is 1 ){ + return data[0] & 0xFF; + } + return -1; + } + + public int read( byte[] b, int off, int len ){ + implMissing( __FILE__, __LINE__ ); + return 0; + } + + public int available(){ + implMissing( __FILE__, __LINE__ ); + return 0; + } + + public long skip( long n ){ + implMissing( __FILE__, __LINE__ ); + return 0L; + } + + public void close(){ + implMissing( __FILE__, __LINE__ ); + } + + public void fill(){ + implMissing( __FILE__, __LINE__ ); + } + + public bool markSupported(){ + implMissing( __FILE__, __LINE__ ); + return false; + } + + public synchronized void mark( int readlimit ){ + implMissing( __FILE__, __LINE__ ); + } + + public synchronized void reset(){ + implMissing( __FILE__, __LINE__ ); + } +} + +