hexStringToByteArray

Converts a hex string returned by ssCore.FileSys.readFileBinary into a ByteArray.


Availability:

First available in version 3.5 build 314.

Available only in ActionScript 3.


Usage:

dataByteArr = StringUtils.hexStringToByteArray(dataStr)

dataByteArr - ByteArray - The hex string data represented as a ByteArray.


Parameters:

dataStr - String - A hex string formatted as two characters per byte returned from ssCore.FileSys.readFileBinary.


Notes:

Editing binary values cannot be done directly in ActionScript, which is why there is the ByteArray class in ActionScript 3. With a ByteArray you can manipulate data at the byte level. Use this function to convert the data returned by ssCore.FileSys.readFileBinary into a ByteArray for editing within ActionScript.

See ssCore.FileSys.appendToFileBinary, ssCore.FileSys.readFileBinary, ssCore.FileSys.writeToFileBinary, and StringUtils.byteArrayToHexString.


Examples:

var r:Object = ssCore.FileSys.readFileBinary({path:"startdir://file.swf"});

var myByteArray:ByteArray = StringUtils.hexStringToByteArray(r.result);