Skip to content
Nick Ryzhy edited this page Apr 4, 2016 · 3 revisions

Encodes and decodes binary data using Base64 algorithm.

Name Value
Package by.blooddy.crypto
Name final class Base64
Inheritance Base64ProcessEventDispatcherObject

Examples

Sync
import by.blooddy.crypto.Base64;
var result:ByteArray = Base64.decode( 'ZWFzdXJlLg==' );
Async
import by.blooddy.crypto.Base64;
import by.blooddy.crypto.events.ProcessEvent;

var base64:Base64 = new Base64();
base64.decode( 'ZWFzdXJlLg==' );
base64.addEventListener( ProcessEvent.COMPLETE, function(event:ProcessEvent):void {
	var result:ByteArray = event.data;
	trace( result ); // async result
} );
base64.addEventListener( ProcessEvent.ERROR, function(event:ProcessEvent):void {
	var error:Error = event.data;
	trace( error ); // async error
} );

Static Methods

Name Description
isValid(str:String):Boolean Return true if str is valid Base64 string.
encode(bytes:ByteArray, newLines:uint=0):String Encodes the ByteArray using Base64 encoding algorithm.
decode(str:String):ByteArray Decodes the String previously encoded using Base64 algorithm.

Constructor

Name Description
Base64() Creates a Base64 object.

Methods

Name Description
encode(bytes:ByteArray, newLines:uint=0):void Asynchronously encodes the ByteArray using Base64 encoding algorithm. Dispatched String result in ProcessEvent.
decode(str:String):void Asynchronously decodes the String previously encoded using Base64 algorithm. Dispatched ByteArray result in ProcessEvent.

Events

Name Type Description
complete ProcessEvent Dispatched when success.
error ProcessEvent Dispatched when fault.

Hashsum

Checksum

Image

Serialization

Clone this wiki locally