FileInput.hx 3.0 KB

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