<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -22,7 +22,7 @@ package org.amqp;
     import flash.events.Event;
     import flash.events.IOErrorEvent;
     import flash.events.ProgressEvent;
-    import flash.Vector;
+    //import flash.Vector;
     import flash.utils.ByteArray;
     #elseif neko
     import org.amqp.Error;
@@ -60,7 +60,6 @@ package org.amqp;
         public var frameMax:Int ;
 
         #if flash9
-        public var recs:Vector&lt;Frame&gt;;
         public var receiving:Bool;
         public var frameBuffer:ByteArray;
         #end
@@ -97,7 +96,6 @@ package org.amqp;
             delegate.addEventListener(IOErrorEvent.IO_ERROR, onSocketError);
             delegate.addEventListener(ProgressEvent.SOCKET_DATA, onSocketData);
 
-            recs = new Vector();
             receiving = false;
             frameBuffer = new ByteArray();
             frameBuffer.position = 0;</diff>
      <filename>src/org/amqp/Connection.hx</filename>
    </modified>
    <modified>
      <diff>@@ -34,8 +34,15 @@ class DataReader {
         return b.readUTFBytes(long());
     }
 
-    inline public function object():Dynamic {
-        return Unserializer.run(string());
+    inline public function object(decompress:Bool = false):Dynamic {
+        // decompress if object was compressed
+        if(decompress) {
+            var by:ByteArray = bytes(long());
+            by.uncompress();
+            return Unserializer.run(by.readUTFBytes(long()));
+        } else {
+            return Unserializer.run(string());
+        }
     }
 
     inline public function byte():Int {
@@ -88,8 +95,13 @@ class DataReader {
         return b.readString(long());
     }
 
-    inline public function object():Dynamic {
-        return Unserializer.run(string());
+    inline public function object(decompress:Bool = false):Dynamic {
+        // decompress if object was compressed
+        if(decompress) {
+            return Unserializer.run(new BytesInput(neko.zip.Uncompress.run(bytes(long()))).readString(long()));
+        } else {
+            return Unserializer.run(string());
+        }
     }
 
     inline public function byte():Int {</diff>
      <filename>src/org/amqp/fast/utils/DataReader.hx</filename>
    </modified>
    <modified>
      <diff>@@ -24,8 +24,23 @@ class DataWriter {
         b.writeUTFBytes(s);
     }
 
-    inline public function object(o:Dynamic):Void {
-        string(Serializer.run(o));
+    inline public function object(o:Dynamic, compress:Bool = false):Int {
+        // for small objects or few fields the compressed version can be bigger
+        if(compress) {
+            var s = Serializer.run(o);
+            var by = new ByteArray();
+            by.writeUTFBytes(s);
+            by.compress();
+            by.position = 0;
+            long(by.length);
+            bytes(by);
+            long(s.length);
+            return by.length;
+        } else {
+            var s = Serializer.run(o);
+            string(s);
+            return s.length;
+        }
     }
 
     inline public function byte(i:Int) {
@@ -76,8 +91,22 @@ class DataWriter {
         b.writeString(s);
     }
 
-    inline public function object(o:Dynamic):Void {
-        string(Serializer.run(o));
+    inline public function object(o:Dynamic, compress:Bool = false):Int {
+        // for small objects or few fields the compressed version can be bigger
+        if(compress) {
+            var bo = new BytesOutput();
+            var s = Serializer.run(o);
+            bo.writeString(s);
+            var cb = neko.zip.Compress.run(bo.getBytes(), 9);
+            long(cb.length);
+            bytes(cb); 
+            long(s.length);
+            return cb.length;
+        } else {
+            var s = Serializer.run(o);
+            string(s);
+            return s.length;
+        }
     }
 
     inline public function byte(i:Int) {</diff>
      <filename>src/org/amqp/fast/utils/DataWriter.hx</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7a4c0368dcdb5f55856853257453136fccc327f0</id>
    </parent>
  </parents>
  <author>
    <name>Ezio Trevisano</name>
    <email>eziotic@gmail.com</email>
  </author>
  <url>http://github.com/geekrelief/hxamqp/commit/e0b6c6f0ece8d0e2a7a1489e8aee30819552dabf</url>
  <id>e0b6c6f0ece8d0e2a7a1489e8aee30819552dabf</id>
  <committed-date>2009-06-14T16:36:32-07:00</committed-date>
  <authored-date>2009-06-14T16:36:32-07:00</authored-date>
  <message>added compression option for objects in DataWriter and DataReader</message>
  <tree>d51e422e6130735197bbe9825ed0f8e477c10adc</tree>
  <committer>
    <name>Ezio Trevisano</name>
    <email>eziotic@gmail.com</email>
  </committer>
</commit>
