|
@@ -7,6 +7,8 @@ import haxe.io.Bytes;
|
|
*/
|
|
*/
|
|
class ByteConversions{
|
|
class ByteConversions{
|
|
|
|
|
|
|
|
+#if (flash || openfl)
|
|
|
|
+
|
|
public static function byteArrayToBytes( v: flash.utils.ByteArray ) : haxe.io.Bytes {
|
|
public static function byteArrayToBytes( v: flash.utils.ByteArray ) : haxe.io.Bytes {
|
|
return
|
|
return
|
|
#if flash
|
|
#if flash
|
|
@@ -19,18 +21,12 @@ class ByteConversions{
|
|
b;
|
|
b;
|
|
};
|
|
};
|
|
#elseif (openfl)
|
|
#elseif (openfl)
|
|
- v;
|
|
|
|
|
|
+ v;
|
|
#else
|
|
#else
|
|
throw "unsupported on this platform";
|
|
throw "unsupported on this platform";
|
|
#end
|
|
#end
|
|
}
|
|
}
|
|
-
|
|
|
|
- #if js
|
|
|
|
- public static function arrayBufferToBytes( v : js.html.ArrayBuffer ) : haxe.io.Bytes{
|
|
|
|
- return byteArrayToBytes(flash.utils.ByteArray.nmeOfBuffer(v));
|
|
|
|
- }
|
|
|
|
- #end
|
|
|
|
-
|
|
|
|
|
|
+
|
|
public static function bytesToByteArray( v: haxe.io.Bytes ) : flash.utils.ByteArray {
|
|
public static function bytesToByteArray( v: haxe.io.Bytes ) : flash.utils.ByteArray {
|
|
#if flash
|
|
#if flash
|
|
return v.getData();
|
|
return v.getData();
|
|
@@ -40,4 +36,13 @@ class ByteConversions{
|
|
throw "unsupported on this platform";
|
|
throw "unsupported on this platform";
|
|
#end
|
|
#end
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ #if js
|
|
|
|
+ public static function arrayBufferToBytes( v : js.html.ArrayBuffer ) : haxe.io.Bytes{
|
|
|
|
+ return byteArrayToBytes(flash.utils.ByteArray.nmeOfBuffer(v));
|
|
|
|
+ }
|
|
|
|
+ #end
|
|
|
|
+
|
|
|
|
+#end
|
|
|
|
+
|
|
}
|
|
}
|