ソースを参照

[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;
 import haxe.Int64;
 import haxe.io.Bytes;
+import haxe.io.Eof;
 import haxe.io.Input;
 
 class NativeInput extends Input
@@ -16,7 +17,9 @@ class NativeInput extends Input
 	
 	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