浏览代码

[cs] handle Eof

Caue Waneck 13 年之前
父节点
当前提交
90569b5d2e
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      std/cs/_std/sys/io/NativeInput.hx

+ 4 - 1
std/cs/_std/sys/io/NativeInput.hx

@@ -1,6 +1,7 @@
 package sys.io;
 package sys.io;
 import haxe.Int64;
 import haxe.Int64;
 import haxe.io.Bytes;
 import haxe.io.Bytes;
+import haxe.io.Eof;
 import haxe.io.Input;
 import haxe.io.Input;
 
 
 class NativeInput extends Input
 class NativeInput extends Input
@@ -16,7 +17,9 @@ class NativeInput extends Input
 	
 	
 	override public function readByte():Int 
 	override public function readByte():Int 
 	{
 	{
-		return stream.ReadByte();
+		var ret = stream.ReadByte();
+		if (ret == -1) throw new Eof();
+		return ret;
 	}
 	}
 	
 	
 	override public function readBytes(s:Bytes, pos:Int, len:Int):Int 
 	override public function readBytes(s:Bytes, pos:Int, len:Int):Int