3 Replies Latest reply on Nov 18, 2009 12:35 PM by flairjax

    ByteArray issues

    flairjax Level 1

      So I have an app where I am saving off objects as byteArray.writeObject(writeableobj) >> base64string >> into database.

       

      Then on the way out I do the opposite database >> base64string >>byteArray.readObject(readableobj)

       

      Everything was working properly and all of a sudden it doesn't work. I haven't made any changes that should make difference.

       

      TypeError: Error #1034: Type Coercion failed: cannot convert 0 to Array.
      RangeError: Error #2006: The supplied index is out of bounds.

       

      Where the line in the stack that is causing this issue is:    var data:* = byteArray.readObject();

       

      Does anyone know where I should start looking?

        • 1. Re: ByteArray issues
          flairjax Level 1

          now I am getting Error: A partial block (3 of 4 bytes) was dropped. Decoded data is probably truncated!

          • 2. Re: ByteArray issues
            flairjax Level 1

            Looks like by base64string (str)  is being truncated, is there a limit on this?

             

            Here is my code:

             

            var base64Enc:Base64Encoder = new Base64Encoder();
                        var str:String = '';
                        base64Enc.encodeBytes( byteArray );
                        str = base64Enc.toString();
                        byteArray.clear();
                        return str;

            • 3. Re: ByteArray issues
              flairjax Level 1

              What is odd is it works perfectly on my MAC but on a windows machine it fails. Beside the error above, I am getting at the end of my base64 string '...' versus what should be '==' so I assume its being truncated.

               

              J