2
0

FileInput.hx 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. * Copyright (C)2005-2017 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 python.io.IFileInput;
  26. class FileInput extends Input
  27. {
  28. var impl:IFileInput;
  29. public function new (impl:IFileInput) {
  30. this.impl = impl;
  31. }
  32. override public function set_bigEndian(b:Bool) {
  33. return impl.bigEndian = b;
  34. }
  35. public function seek( p : Int, pos : FileSeek ) : Void {
  36. return impl.seek(p, pos);
  37. }
  38. public function tell() : Int {
  39. return impl.tell();
  40. }
  41. public function eof() : Bool {
  42. return impl.eof();
  43. }
  44. override public function readByte() : Int {
  45. return impl.readByte();
  46. }
  47. override public function readBytes( s : Bytes, pos : Int, len : Int ) : Int {
  48. return impl.readBytes(s, pos, len);
  49. }
  50. override public function close():Void {
  51. impl.close();
  52. }
  53. override public function readAll( ?bufsize : Int ) : Bytes {
  54. return impl.readAll(bufsize);
  55. }
  56. override public function readFullBytes( s : Bytes, pos : Int, len : Int ):Void {
  57. impl.readFullBytes(s, pos, len);
  58. }
  59. override public function read( nbytes : Int ) : Bytes {
  60. return impl.read(nbytes);
  61. }
  62. override public function readUntil( end : Int ) : String {
  63. return impl.readUntil(end);
  64. }
  65. override public function readLine() : String {
  66. return impl.readLine();
  67. }
  68. override public function readFloat() : Float {
  69. return impl.readFloat();
  70. }
  71. override public function readDouble() : Float {
  72. return impl.readDouble();
  73. }
  74. override public function readInt8():Int {
  75. return impl.readInt8();
  76. }
  77. override public function readInt16():Int {
  78. return impl.readInt16();
  79. }
  80. override public function readUInt16():Int {
  81. return impl.readUInt16();
  82. }
  83. override public function readInt24():Int {
  84. return impl.readInt24();
  85. }
  86. override public function readUInt24():Int {
  87. return impl.readUInt24();
  88. }
  89. override public function readInt32():Int {
  90. return impl.readInt32();
  91. }
  92. override public function readString( len : Int ) : String {
  93. return impl.readString(len);
  94. }
  95. }