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 DirectShortBufferRU
  14. extends DirectShortBufferU
  15. implements DirectBuffer
  16. {
  17. // For duplicates and slices
  18. //
  19. DirectShortBufferRU(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 ShortBuffer 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 << 1);
  31. return new DirectShortBufferRU(this, -1, 0, rem, rem, off);
  32. }
  33. public ShortBuffer duplicate() {
  34. return new DirectShortBufferRU(this,
  35. this.markValue(),
  36. this.position(),
  37. this.limit(),
  38. this.capacity(),
  39. 0);
  40. }
  41. public ShortBuffer asReadOnlyBuffer() {
  42. return duplicate();
  43. }
  44. public ShortBuffer put(short x) {
  45. throw new ReadOnlyBufferException();
  46. }
  47. public ShortBuffer put(int i, short x) {
  48. throw new ReadOnlyBufferException();
  49. }
  50. public ShortBuffer put(ShortBuffer src) {
  51. throw new ReadOnlyBufferException();
  52. }
  53. public ShortBuffer put(short[] src, int offset, int length) {
  54. throw new ReadOnlyBufferException();
  55. }
  56. public ShortBuffer 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. }