Skip to content

Commit

Permalink
avm2: Implement IDataOutput
Browse files Browse the repository at this point in the history
  • Loading branch information
Bale001 committed Sep 17, 2022
1 parent b1aff49 commit bfca30f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/src/avm2/globals/flash/utils/ByteArray.as
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package flash.utils {
[Ruffle(InstanceAllocator)]
public class ByteArray implements IDataInput {
public class ByteArray implements IDataInput, IDataOutput {
private static var _defaultObjectEncoding:uint = 3;
public static function get defaultObjectEncoding():uint {
return _defaultObjectEncoding;
Expand Down Expand Up @@ -68,5 +68,9 @@ package flash.utils {
public native function writeUnsignedInt(value:uint):void;
public native function writeUTF(value:String):void;
public native function writeUTFBytes(value:String):void;
public function writeObject(object:*):void {
// STUB
throw new Error("ByteArray.writeObject not implemented");
}
}
}
22 changes: 22 additions & 0 deletions core/src/avm2/globals/flash/utils/IDataOutput.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package flash.utils {
public interface IDataOutput {
function get objectEncoding():uint;
function set objectEncoding(version:uint):void;

function get endian():String;
function set endian(type:String):void;

function writeBoolean(value:Boolean):void;
function writeByte(value:int):void;
function writeBytes(bytes:ByteArray, offset:uint = 0, length:uint = 0):void;
function writeDouble(value:Number):void;
function writeFloat(value:Number):void;
function writeInt(value:int):void;
function writeMultiByte(value:String, charSet:String):void;
function writeObject(object:*):void; // NOPMD WronglyNamedVariable
function writeShort(value:int):void;
function writeUnsignedInt(value:uint):void;
function writeUTF(value:String):void;
function writeUTFBytes(value:String):void;
}
}
1 change: 1 addition & 0 deletions core/src/avm2/globals/globals.as
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ include "Math.as"
include "flash/accessibility/AccessibilityProperties.as"
include "flash/crypto.as"
include "flash/utils/IDataInput.as"
include "flash/utils/IDataOutput.as"
include "flash/utils/ByteArray.as"
include "flash/desktop/ClipboardFormats.as"
include "flash/desktop/ClipboardTransferMode.as"
Expand Down

0 comments on commit bfca30f

Please sign in to comment.