FileOutput.hx 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * Copyright (C)2005-2015 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. package sys.io;
  23. import haxe.io.Bytes;
  24. import haxe.io.Input;
  25. import haxe.io.Output;
  26. import python.io.IFileOutput;
  27. class FileOutput extends Output {
  28. var impl:IFileOutput;
  29. public function new (impl:IFileOutput) {
  30. this.impl = impl;
  31. }
  32. public function seek( p : Int, pos : FileSeek ) : Void {
  33. return impl.seek(p, pos);
  34. }
  35. public function tell() : Int {
  36. return impl.tell();
  37. }
  38. override public function set_bigEndian(b:Bool) {
  39. return impl.bigEndian = b;
  40. }
  41. override public function writeByte( c : Int ) : Void {
  42. impl.writeByte(c);
  43. }
  44. override public function writeBytes( s : Bytes, pos : Int, len : Int ):Int {
  45. return impl.writeBytes(s,pos,len);
  46. }
  47. override public function flush():Void {
  48. impl.flush();
  49. }
  50. override public function close():Void {
  51. impl.close();
  52. }
  53. override public function write( s : Bytes ) : Void {
  54. impl.write(s);
  55. }
  56. override public function writeFullBytes( s : Bytes, pos : Int, len : Int ):Void {
  57. impl.writeFullBytes(s,pos,len);
  58. }
  59. override public function writeFloat( x : Float ):Void {
  60. impl.writeFloat(x);
  61. }
  62. override public function writeDouble( x : Float ):Void {
  63. impl.writeDouble(x);
  64. }
  65. override public function writeInt8( x : Int ):Void {
  66. impl.writeInt8(x);
  67. }
  68. override public function writeInt16( x : Int ):Void {
  69. impl.writeInt16(x);
  70. }
  71. override public function writeUInt16( x : Int ):Void {
  72. impl.writeUInt16(x);
  73. }
  74. override public function writeInt24( x : Int ):Void {
  75. impl.writeInt24(x);
  76. }
  77. override public function writeUInt24( x : Int ):Void {
  78. impl.writeUInt24(x);
  79. }
  80. override public function writeInt32( x : Int ):Void {
  81. impl.writeInt32(x);
  82. }
  83. override public function prepare( nbytes : Int ):Void {
  84. impl.prepare(nbytes);
  85. }
  86. override public function writeInput( i : Input, ?bufsize : Int ):Void {
  87. impl.writeInput(i,bufsize);
  88. }
  89. override public function writeString( s : String ):Void {
  90. impl.writeString(s);
  91. }
  92. }