A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: [RESOLVED] GZip Compression Between Java and AS3?

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    6

    resolved [RESOLVED] GZip Compression Between Java and AS3?

    Does anyone know how one can compress a bytearray (byte[]) in java using gzip then uncompress it in AS3 and vice-versa?

    Please provide example code or links to exampls

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    on the flash side the byte array supports zlib compression, so you should probably look for zlib on the java side as well
    If the bytearray is completely compressed, as3 is just
    Code:
    bytes.uncompress()
    If you have compressed and uncompressed portions (like a swf file with 8 bytes header), you would copy the compressed part to a new bytearray first. This is part of an swf reader
    Code:
    bytes.position = 8;
    var newbytes:ByteArray = new ByteArray();
    bytes.readBytes(newbytes, 0, bytes.length-bytes.position);
    newbytes.uncompress();
    newbytes.position = 0;
    Musicman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center