|
@@ -21,20 +21,31 @@
|
|
|
*/
|
|
|
package haxe.zip;
|
|
|
|
|
|
+import java.util.zip.Inflater;
|
|
|
+
|
|
|
class Uncompress
|
|
|
{
|
|
|
+ final inflater:Inflater;
|
|
|
+
|
|
|
public function new( ?windowBits : Int ) {
|
|
|
- throw "Not implemented for this platform";
|
|
|
+ inflater = new Inflater(windowBits != null && windowBits < 0);
|
|
|
}
|
|
|
|
|
|
public function execute( src : haxe.io.Bytes, srcPos : Int, dst : haxe.io.Bytes, dstPos : Int ) : { done : Bool, read : Int, write : Int } {
|
|
|
- return null;
|
|
|
+ inflater.setInput(src.getData(), srcPos, src.length - srcPos);
|
|
|
+ inflater.inflate(dst.getData(), dstPos, dst.length - dstPos);
|
|
|
+ return {
|
|
|
+ done: inflater.finished(),
|
|
|
+ read: Int64.toInt(inflater.getBytesRead()),
|
|
|
+ write: Int64.toInt(inflater.getBytesWritten())
|
|
|
+ };
|
|
|
}
|
|
|
|
|
|
public function setFlushMode( f : FlushMode ) {
|
|
|
}
|
|
|
|
|
|
public function close() {
|
|
|
+ inflater.end();
|
|
|
}
|
|
|
|
|
|
public static function run( src : haxe.io.Bytes, ?bufsize : Int ) : haxe.io.Bytes
|