1. /*
  2. * @(#)Heap-X-Buffer.java 1.28 03/12/19
  3. *
  4. * Copyright 2004 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. /**
  10. * A read-only HeapFloatBuffer. This class extends the corresponding
  11. * read/write class, overriding the mutation methods to throw a {@link
  12. * ReadOnlyBufferException} and overriding the view-buffer methods to return an
  13. * instance of this class rather than of the superclass.
  14. */
  15. class HeapFloatBufferR
  16. extends HeapFloatBuffer
  17. {
  18. // For speed these fields are actually declared in X-Buffer;
  19. // these declarations are here as documentation
  20. /*
  21. */
  22. HeapFloatBufferR(int cap, int lim) { // package-private
  23. super(cap, lim);
  24. this.isReadOnly = true;
  25. }
  26. HeapFloatBufferR(float[] buf, int off, int len) { // package-private
  27. super(buf, off, len);
  28. this.isReadOnly = true;
  29. }
  30. protected HeapFloatBufferR(float[] buf,
  31. int mark, int pos, int lim, int cap,
  32. int off)
  33. {
  34. super(buf, mark, pos, lim, cap, off);
  35. this.isReadOnly = true;
  36. }
  37. public FloatBuffer slice() {
  38. return new HeapFloatBufferR(hb,
  39. -1,
  40. 0,
  41. this.remaining(),
  42. this.remaining(),
  43. this.position() + offset);
  44. }
  45. public FloatBuffer duplicate() {
  46. return new HeapFloatBufferR(hb,
  47. this.markValue(),
  48. this.position(),
  49. this.limit(),
  50. this.capacity(),
  51. offset);
  52. }
  53. public FloatBuffer asReadOnlyBuffer() {
  54. return duplicate();
  55. }
  56. public boolean isReadOnly() {
  57. return true;
  58. }
  59. public FloatBuffer put(float x) {
  60. throw new ReadOnlyBufferException();
  61. }
  62. public FloatBuffer put(int i, float x) {
  63. throw new ReadOnlyBufferException();
  64. }
  65. public FloatBuffer put(float[] src, int offset, int length) {
  66. throw new ReadOnlyBufferException();
  67. }
  68. public FloatBuffer put(FloatBuffer src) {
  69. throw new ReadOnlyBufferException();
  70. }
  71. public FloatBuffer compact() {
  72. throw new ReadOnlyBufferException();
  73. }
  74. public ByteOrder order() {
  75. return ByteOrder.nativeOrder();
  76. }
  77. }