Mercurial > projects > dwt-win
diff dwt/dwthelper/InflaterInputStream.d @ 248:d10ff1f47f84
Add: version TANGOSVN
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 06 Jul 2008 16:42:54 +0200 |
parents | 5406a8f6526d |
children | f6169caa2e05 |
line wrap: on
line diff
--- a/dwt/dwthelper/InflaterInputStream.d Tue Jun 24 22:05:28 2008 +0200 +++ b/dwt/dwthelper/InflaterInputStream.d Sun Jul 06 16:42:54 2008 +0200 @@ -5,6 +5,42 @@ public import dwt.dwthelper.InputStream; import dwt.dwthelper.utils; +import tango.io.Stdout; +import tango.io.compress.ZlibStream; +version(TANGOSVN) { + import tango.io.Conduit; +} +class InputStreamWrapper : tango.io.model.IConduit.InputStream { + + dwt.dwthelper.InputStream.InputStream istr; + + this( dwt.dwthelper.InputStream.InputStream istr ){ + this.istr = istr; + } + + uint read (void[] dst){ + int res = istr.read( cast(byte[])dst ); + return res; + } +version(TANGOSVN) { + 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(); + } +} public class InflaterInputStream : dwt.dwthelper.InputStream.InputStream { @@ -20,12 +56,19 @@ protected int len; package bool usesDefaultInflater = false; + ZlibInput tangoIstr; + public this ( dwt.dwthelper.InputStream.InputStream istr ){ + tangoIstr = new ZlibInput( new InputStreamWrapper(istr )); } public int read(){ - implMissing( __FILE__, __LINE__ ); - return 0; + 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 ){