ByteBuffer.hx 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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.nio;
  23. import haxe.Int64;
  24. import haxe.io.BytesData;
  25. import java.StdTypes;
  26. extern class ByteBuffer extends Buffer
  27. {
  28. static function allocate(capacity:Int):ByteBuffer;
  29. static function allocateDirect(capacity:Int):ByteBuffer;
  30. @:overload(function(arr:BytesData, offset:Int, length:Int):ByteBuffer {})
  31. static function wrap(arr:BytesData):ByteBuffer;
  32. function array():BytesData;
  33. function arrayOffset():Int;
  34. function compact():ByteBuffer;
  35. function compareTo(obj:Dynamic):Int;
  36. function duplicate():ByteBuffer;
  37. @:overload(function (dst:BytesData, offset:Int, length:Int):ByteBuffer {})
  38. @:overload(function (dst:BytesData):ByteBuffer {})
  39. @:overload(function (idx:Int):Int8 {})
  40. function get():Int8;
  41. @:overload(function (index:Int):Char16 {})
  42. function getChar():Char16;
  43. @:overload(function (index:Int):Float {})
  44. function getDouble():Float;
  45. @:overload(function (index:Int):Single {})
  46. function getFloat():Single;
  47. @:overload(function (index:Int):Int {})
  48. function getInt():Int;
  49. @:overload(function (index:Int):Int64 {})
  50. function getLong():Int64;
  51. @:overload(function (index:Int):Int16 {})
  52. function getShort():Int16;
  53. function hasArray():Bool;
  54. function isDirect():Bool;
  55. @:overload(function (index:ByteOrder):ByteBuffer {})
  56. function order():ByteOrder;
  57. @:overload(function (index:Int, b:Int8):ByteBuffer {})
  58. @:overload(function (src:ByteBuffer):ByteBuffer {})
  59. @:overload(function (src:BytesData, offset:Int, length:Int):ByteBuffer {})
  60. @:overload(function (src:BytesData):ByteBuffer {})
  61. function put(b:Int8):ByteBuffer;
  62. @:overload(function (index:Int, value:Char16):ByteBuffer {})
  63. function putChar(value:Char16):ByteBuffer;
  64. @:overload(function (index:Int, value:Float):ByteBuffer {})
  65. function putDouble(value:Float):ByteBuffer;
  66. @:overload(function (index:Int, value:Single):ByteBuffer {})
  67. function putFloat(value:Single):ByteBuffer;
  68. @:overload(function (index:Int, value:Int):ByteBuffer {})
  69. function putInt(value:Int):ByteBuffer;
  70. @:overload(function (index:Int, value:Int64):ByteBuffer {})
  71. function putLong(value:Int64):ByteBuffer;
  72. @:overload(function (index:Int, value:Int16):ByteBuffer {})
  73. function putShort(value:Int16):ByteBuffer;
  74. }