Explorar o código

[python] implement writeBytes in NativeBytesOutput (which is used for sys.io.File.write)

so we don't write one byte at a time like geniuses
Dan Korostelev %!s(int64=6) %!d(string=hai) anos
pai
achega
01bab8830b
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      std/python/io/NativeBytesOutput.hx

+ 4 - 0
std/python/io/NativeBytesOutput.hx

@@ -47,4 +47,8 @@ class NativeBytesOutput extends NativeOutput<RawIOBase>{
 	{
 	{
 		stream.write(new Bytearray([c]));
 		stream.write(new Bytearray([c]));
 	}
 	}
+
+	override function writeBytes( s : haxe.io.Bytes, pos : Int, len : Int ) : Int {
+		return stream.write(python.Syntax.code("{0}[{1}:{2}]", s.getData(), pos, pos + len));
+	}
 }
 }