Flex 4.6: How does Air Application writes flat image like qemu-img?

345 views Asked by At

I would like to write and update a flat image like qemu-img.

I have coded this fsFile.as

package com.bytehost.snakemedia.utils {
    import flash.utils.ByteArray;

    public class fsFile {
        private var _fsFilename:String;
        private var _fsZeroSize:ByteArray;
        private var _fileModificationTime:Date;
        private var _fsFileSystem:Object;

        public function fsFile( fsZeroSize:ByteArray,
                                fileModificationTime:Date,
                                fsFilename:String="",
                                fsFileSystem:Object=null) {
            _fsFilename = fsFilename;
            _fsZeroSize = fsZeroSize;
            _fsFileSystem = fsFileSystem;
        }

        public function get fsFileName():String {
            return _fsFilename;
        }

        public function get fileModificationTime():Date {
            return _fileModificationTime;
        }

        public function getfsZeroSize():ByteArray {
            var fsByte:ByteArray = new ByteArray();
            _fsZeroSize.position = 0;
            _fsZeroSize.readBytes(fsByte, 0, _fsZeroSize.length);
            return fsByte;
        }

        public function get fsFileSystem():Object {
            return _fsFileSystem;
        }
    }
}

Is this right or wrong? Or what do I need encoder for Actionscript 3? How do I know when I create flat image like 3 GB = 3072 MB myimage.fs But I want to be sure.

I must create simple Mount function like qemu -hdb ( mounting mode ) Also I need code for Air Native Extensions?

1

There are 1 answers

1
Eugene On BEST ANSWER

I would advice to take a look into the side of AIR Native Extensions (ANE packages embedded in the project via SWC wrappers)

You can find all needed information to start here: http://www.adobe.com/devnet/air/native-extensions-for-air.html

So you about FS manager, take a look into the C or Java code. It depends which platform you want application to work on.

And don't forget that you can include binary libraries too!

Just a quote from this link: http://www.adobe.com/devnet/air/articles/extending-air.html

Platform Form

Android = Java Archive (.jar) or shared library (.so)

iOS = Static library (.a)

OS X = Framework (.framework)

Windows = Dynamic Link Library (.dll)