浏览代码

[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 6 年之前
父节点
当前提交
01bab8830b
共有 1 个文件被更改,包括 4 次插入0 次删除
  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]));
 	}
+
+	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));
+	}
 }