1. /*
  2. * @(#)ByteBufferAs-X-Buffer.java 1.17 04/05/03
  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. class ByteBufferAsShortBufferRB // package-private
  10. extends ByteBufferAsShortBufferB
  11. {
  12. ByteBufferAsShortBufferRB(ByteBuffer bb) { // package-private
  13. super(bb);
  14. }
  15. ByteBufferAsShortBufferRB(ByteBuffer bb,
  16. int mark, int pos, int lim, int cap,
  17. int off)
  18. {
  19. super(bb, mark, pos, lim, cap, off);
  20. }
  21. public ShortBuffer slice() {
  22. int pos = this.position();
  23. int lim = this.limit();
  24. assert (pos <= lim);
  25. int rem = (pos <= lim ? lim - pos : 0);
  26. int off = (pos << 1) + offset;
  27. assert (off >= 0);
  28. return new ByteBufferAsShortBufferRB(bb, -1, 0, rem, rem, off);
  29. }
  30. public ShortBuffer duplicate() {
  31. return new ByteBufferAsShortBufferRB(bb,
  32. this.markValue(),
  33. this.position(),
  34. this.limit(),
  35. this.capacity(),
  36. offset);
  37. }
  38. public ShortBuffer asReadOnlyBuffer() {
  39. return duplicate();
  40. }
  41. public ShortBuffer put(short x) {
  42. throw new ReadOnlyBufferException();
  43. }
  44. public ShortBuffer put(int i, short x) {
  45. throw new ReadOnlyBufferException();
  46. }
  47. public ShortBuffer compact() {
  48. throw new ReadOnlyBufferException();
  49. }
  50. public boolean isDirect() {
  51. return bb.isDirect();
  52. }
  53. public boolean isReadOnly() {
  54. return true;
  55. }
  56. public ByteOrder order() {
  57. return ByteOrder.BIG_ENDIAN;
  58. }
  59. }