Browse Source

Improve NativeOutput performance (#11944)

Barış Yıldırım 8 months ago
parent
commit
c80a17cd4a
1 changed files with 14 additions and 0 deletions
  1. 14 0
      std/jvm/io/NativeOutput.hx

+ 14 - 0
std/jvm/io/NativeOutput.hx

@@ -46,6 +46,20 @@ import java.io.IOException;
 		}
 		}
 	}
 	}
 
 
+	override public function writeBytes(s:Bytes, pos:Int, len:Int) {
+		if (pos < 0 || len < 0 || pos + len > s.length)
+			throw haxe.io.Error.OutsideBounds;
+		try {
+			stream.write(s.getData(), pos, len);
+		} catch (e:EOFException) {
+
+			throw new Eof();
+		} catch (e:IOException) {
+			throw haxe.io.Error.Custom(e);
+		}
+		return len;
+	}
+
 	override public function close():Void {
 	override public function close():Void {
 		try {
 		try {
 			stream.close();
 			stream.close();