Browse Source

added position property.

Nicolas Cannasse 12 years ago
parent
commit
3455b6fc12
1 changed files with 18 additions and 0 deletions
  1. 18 0
      std/haxe/io/BytesInput.hx

+ 18 - 0
std/haxe/io/BytesInput.hx

@@ -27,6 +27,8 @@ class BytesInput extends Input {
 	var pos : Int;
 	var pos : Int;
 	var len : Int;
 	var len : Int;
 	#end
 	#end
+	
+	public var position(get,set) : Int;
 
 
 	public function new( b : Bytes, ?pos : Int, ?len : Int ) {
 	public function new( b : Bytes, ?pos : Int, ?len : Int ) {
 		if( pos == null ) pos = 0;
 		if( pos == null ) pos = 0;
@@ -48,7 +50,23 @@ class BytesInput extends Input {
 		this.len = len;
 		this.len = len;
 		#end
 		#end
 	}
 	}
+	
+	function get_position() : Int {
+		#if flash9
+		return b.position;
+		#else
+		return pos;
+		#end
+	}
 
 
+	function set_position( p : Int ) : Int {
+		#if flash9
+		return b.position = p;
+		#else
+		return pos = p;
+		#end
+	}
+	
 	public override function readByte() : Int {
 	public override function readByte() : Int {
 		#if flash9
 		#if flash9
 			return try b.readUnsignedByte() catch( e : Dynamic ) throw new Eof();
 			return try b.readUnsignedByte() catch( e : Dynamic ) throw new Eof();