1. /*
  2. * @(#)Direct-X-Buffer.java 1.45 03/04/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. // -- This file was mechanically generated: Do not edit! -- //
  8. package java.nio;
  9. import sun.misc.Cleaner;
  10. import sun.misc.Unsafe;
  11. import sun.nio.ch.DirectBuffer;
  12. import sun.nio.ch.FileChannelImpl;
  13. class DirectFloatBufferRU
  14. extends DirectFloatBufferU
  15. implements DirectBuffer
  16. {
  17. // For duplicates and slices
  18. //
  19. DirectFloatBufferRU(DirectBuffer db, // package-private
  20. int mark, int pos, int lim, int cap,
  21. int off)
  22. {
  23. super(db, mark, pos, lim, cap, off);
  24. }
  25. public FloatBuffer slice() {
  26. int pos = this.position();
  27. int lim = this.limit();
  28. assert (pos <= lim);
  29. int rem = (pos <= lim ? lim - pos : 0);
  30. int off = (pos << 2);
  31. return new DirectFloatBufferRU(this, -1, 0, rem, rem, off);
  32. }
  33. public FloatBuffer duplicate() {
  34. return new DirectFloatBufferRU(this,
  35. this.markValue(),
  36. this.position(),
  37. this.limit(),
  38. this.capacity(),
  39. 0);
  40. }
  41. public FloatBuffer asReadOnlyBuffer() {
  42. return duplicate();
  43. }
  44. public FloatBuffer put(float x) {
  45. throw new ReadOnlyBufferException();
  46. }
  47. public FloatBuffer put(int i, float x) {
  48. throw new ReadOnlyBufferException();
  49. }
  50. public FloatBuffer put(FloatBuffer src) {
  51. throw new ReadOnlyBufferException();
  52. }
  53. public FloatBuffer put(float[] src, int offset, int length) {
  54. throw new ReadOnlyBufferException();
  55. }
  56. public FloatBuffer compact() {
  57. throw new ReadOnlyBufferException();
  58. }
  59. public boolean isDirect() {
  60. return true;
  61. }
  62. public boolean isReadOnly() {
  63. return true;
  64. }
  65. public ByteOrder order() {
  66. return ((ByteOrder.nativeOrder() != ByteOrder.BIG_ENDIAN)
  67. ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN);
  68. }
  69. }