• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Adobe Media Server - ByteArray

New Here ,
Jul 09, 2014 Jul 09, 2014

Copy link to clipboard

Copied

How are you supposed to access the data in a ByteArray? ByteArray.readBytes reads into another byte array which perpetuates the problem. I want to return the data so that I can manipulate it. What am I missing?

    var data  = new ByteArray();

    var file  = new File(path);

    var pos   = 0;

    var bytes = 500 * 1024; // bytes

    if( !file.exists ) {

        trace(path + ' does not exist');

        return;

    }

   /*

    | Opens an FLV file in binary mode

    */

    if( !file.open('binary', 'read') ) {

         trace('Cannot open file');

         return;

    }

    if( file.length < bytes ) {

        bytes = file.length;

    }

    

    /*

    | Neither valueOf or toString provide the data I want.

    | Both return "FLV" as a value not the data.

    */

    file.readBytes(data, pos, bytes);

    trace(data.valueOf());  // DOES NOT WORK

    trace(data.toString()); // DOES NOT WORK

Views

328

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jan 21, 2018 Jan 21, 2018

Copy link to clipboard

Copied

LATEST

Thread little old, but I guess that a serialization of bytes was needed here.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines