Selaa lähdekoodia

Improve NativeOutput performance (#11944)

Barış Yıldırım 8 kuukautta sitten
vanhempi
commit
c80a17cd4a
1 muutettua tiedostoa jossa 14 lisäystä ja 0 poistoa
  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 {
 		try {
 			stream.close();