浏览代码

[java] fixed issue #1130

Caue Waneck 13 年之前
父节点
当前提交
896a7389fa
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      std/java/_std/sys/io/FileInput.hx

+ 7 - 1
std/java/_std/sys/io/FileInput.hx

@@ -57,9 +57,10 @@ class FileInput extends Input {
 	
 	
 	override public function readBytes(s:Bytes, pos:Int, len:Int):Int 
 	override public function readBytes(s:Bytes, pos:Int, len:Int):Int 
 	{
 	{
+		var ret = 0;
 		try
 		try
 		{
 		{
-			return f.read(s.getData(), pos, len);
+			ret = f.read(s.getData(), pos, len);
 		}
 		}
 		
 		
 		catch (e:EOFException) {
 		catch (e:EOFException) {
@@ -69,6 +70,11 @@ class FileInput extends Input {
 		catch (e:IOException) {
 		catch (e:IOException) {
 			throw haxe.io.Error.Custom(e);
 			throw haxe.io.Error.Custom(e);
 		}
 		}
+
+		if (ret == -1)
+			throw new Eof();
+		
+		return ret;
 	}
 	}
 	
 	
 	public function seek( p : Int, pos : FileSeek ) : Void
 	public function seek( p : Int, pos : FileSeek ) : Void