RandomAccessFile.hx 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (C)2005-2012 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 java.io;
  23. import haxe.Int64;
  24. import haxe.io.BytesData;
  25. import java.StdTypes;
  26. //FIXME: this is incomplete
  27. extern class RandomAccessFile
  28. {
  29. function new(f:File, mode:String):Void;
  30. function close():Void;
  31. function getFilePointer():Int64;
  32. function length():Int64;
  33. @:overload(function(b:BytesData, pos:Int, len:Int):Int {})
  34. function read():Int;
  35. function readBoolean():Bool;
  36. function readByte():Int8;
  37. function readChar():Char16;
  38. function readDouble():Float;
  39. function readFloat():Single;
  40. @:overload(function(b:BytesData, off:Int, len:Int):Void {})
  41. function readFully(b:BytesData):Void;
  42. function readInt():Int;
  43. function readLine():String;
  44. function readLong():Int64;
  45. function readShort():Int16;
  46. function readUnsignedByte():Int;
  47. function readUnsignedShort():Int;
  48. function readUTF():String;
  49. function seek(pos:Int64):Void;
  50. function setLength(newLength:Int):Void;
  51. function skipBytes(n:Int):Int;
  52. @:overload(function(b:BytesData, off:Int, len:Int):Void {})
  53. @:overload(function(b:BytesData):Void {})
  54. function write(i:Int):Void;
  55. function writeBoolean(b:Bool):Void;
  56. function writeByte(v:Int):Void;
  57. function writeChar(v:Int):Void;
  58. function writeChars(s:String):Void;
  59. function writeDouble(v:Float):Void;
  60. function writeFloat(v:Single):Void;
  61. function writeInt(v:Int):Void;
  62. function writeLong(v:Int64):Void;
  63. function writeShort(v:Int16):Void;
  64. function writeUTF(str:String):Void;
  65. }