home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / java / nio / HeapByteBuffer.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  5.4 KB  |  270 lines

  1. package java.nio;
  2.  
  3. class HeapByteBuffer extends ByteBuffer {
  4.    HeapByteBuffer(int var1, int var2) {
  5.       super(-1, 0, var2, var1, new byte[var1], 0);
  6.    }
  7.  
  8.    HeapByteBuffer(byte[] var1, int var2, int var3) {
  9.       super(-1, var2, var2 + var3, var1.length, var1, 0);
  10.    }
  11.  
  12.    protected HeapByteBuffer(byte[] var1, int var2, int var3, int var4, int var5, int var6) {
  13.       super(var2, var3, var4, var5, var1, var6);
  14.    }
  15.  
  16.    public ByteBuffer slice() {
  17.       return new HeapByteBuffer(this.hb, -1, 0, this.remaining(), this.remaining(), this.position() + this.offset);
  18.    }
  19.  
  20.    public ByteBuffer duplicate() {
  21.       return new HeapByteBuffer(this.hb, this.markValue(), this.position(), this.limit(), this.capacity(), this.offset);
  22.    }
  23.  
  24.    public ByteBuffer asReadOnlyBuffer() {
  25.       return new HeapByteBufferR(this.hb, this.markValue(), this.position(), this.limit(), this.capacity(), this.offset);
  26.    }
  27.  
  28.    // $FF: renamed from: ix (int) int
  29.    protected int method_0(int var1) {
  30.       return var1 + this.offset;
  31.    }
  32.  
  33.    public byte get() {
  34.       return this.hb[this.method_0(this.nextGetIndex())];
  35.    }
  36.  
  37.    public byte get(int var1) {
  38.       return this.hb[this.method_0(this.checkIndex(var1))];
  39.    }
  40.  
  41.    public ByteBuffer get(byte[] var1, int var2, int var3) {
  42.       checkBounds(var2, var3, var1.length);
  43.       if (var3 > this.remaining()) {
  44.          throw new BufferUnderflowException();
  45.       } else {
  46.          System.arraycopy(this.hb, this.method_0(this.position()), var1, var2, var3);
  47.          this.position(this.position() + var3);
  48.          return this;
  49.       }
  50.    }
  51.  
  52.    public boolean isDirect() {
  53.       return false;
  54.    }
  55.  
  56.    public boolean isReadOnly() {
  57.       return false;
  58.    }
  59.  
  60.    public ByteBuffer put(byte var1) {
  61.       this.hb[this.method_0(this.nextPutIndex())] = var1;
  62.       return this;
  63.    }
  64.  
  65.    public ByteBuffer put(int var1, byte var2) {
  66.       this.hb[this.method_0(this.checkIndex(var1))] = var2;
  67.       return this;
  68.    }
  69.  
  70.    public ByteBuffer put(byte[] var1, int var2, int var3) {
  71.       checkBounds(var2, var3, var1.length);
  72.       if (var3 > this.remaining()) {
  73.          throw new BufferOverflowException();
  74.       } else {
  75.          System.arraycopy(var1, var2, this.hb, this.method_0(this.position()), var3);
  76.          this.position(this.position() + var3);
  77.          return this;
  78.       }
  79.    }
  80.  
  81.    public ByteBuffer put(ByteBuffer var1) {
  82.       if (var1 instanceof HeapByteBuffer) {
  83.          if (var1 == this) {
  84.             throw new IllegalArgumentException();
  85.          }
  86.  
  87.          HeapByteBuffer var2 = (HeapByteBuffer)var1;
  88.          int var3 = var2.remaining();
  89.          if (var3 > this.remaining()) {
  90.             throw new BufferOverflowException();
  91.          }
  92.  
  93.          System.arraycopy(var2.hb, var2.method_0(var2.position()), this.hb, this.method_0(this.position()), var3);
  94.          var2.position(var2.position() + var3);
  95.          this.position(this.position() + var3);
  96.       } else if (var1.isDirect()) {
  97.          int var4 = var1.remaining();
  98.          if (var4 > this.remaining()) {
  99.             throw new BufferOverflowException();
  100.          }
  101.  
  102.          var1.get(this.hb, this.method_0(this.position()), var4);
  103.          this.position(this.position() + var4);
  104.       } else {
  105.          super.put(var1);
  106.       }
  107.  
  108.       return this;
  109.    }
  110.  
  111.    public ByteBuffer compact() {
  112.       System.arraycopy(this.hb, this.method_0(this.position()), this.hb, this.method_0(0), this.remaining());
  113.       this.position(this.remaining());
  114.       this.limit(this.capacity());
  115.       return this;
  116.    }
  117.  
  118.    byte _get(int var1) {
  119.       return this.hb[var1];
  120.    }
  121.  
  122.    void _put(int var1, byte var2) {
  123.       this.hb[var1] = var2;
  124.    }
  125.  
  126.    public char getChar() {
  127.       return Bits.getChar(this, this.method_0(this.nextGetIndex(2)), this.bigEndian);
  128.    }
  129.  
  130.    public char getChar(int var1) {
  131.       return Bits.getChar(this, this.method_0(this.checkIndex(var1, 2)), this.bigEndian);
  132.    }
  133.  
  134.    public ByteBuffer putChar(char var1) {
  135.       Bits.putChar(this, this.method_0(this.nextPutIndex(2)), var1, this.bigEndian);
  136.       return this;
  137.    }
  138.  
  139.    public ByteBuffer putChar(int var1, char var2) {
  140.       Bits.putChar(this, this.method_0(this.checkIndex(var1, 2)), var2, this.bigEndian);
  141.       return this;
  142.    }
  143.  
  144.    public CharBuffer asCharBuffer() {
  145.       int var1 = this.remaining() >> 1;
  146.       int var2 = this.offset + this.position();
  147.       return (CharBuffer)(this.bigEndian ? new ByteBufferAsCharBufferB(this, -1, 0, var1, var1, var2) : new ByteBufferAsCharBufferL(this, -1, 0, var1, var1, var2));
  148.    }
  149.  
  150.    public short getShort() {
  151.       return Bits.getShort(this, this.method_0(this.nextGetIndex(2)), this.bigEndian);
  152.    }
  153.  
  154.    public short getShort(int var1) {
  155.       return Bits.getShort(this, this.method_0(this.checkIndex(var1, 2)), this.bigEndian);
  156.    }
  157.  
  158.    public ByteBuffer putShort(short var1) {
  159.       Bits.putShort(this, this.method_0(this.nextPutIndex(2)), var1, this.bigEndian);
  160.       return this;
  161.    }
  162.  
  163.    public ByteBuffer putShort(int var1, short var2) {
  164.       Bits.putShort(this, this.method_0(this.checkIndex(var1, 2)), var2, this.bigEndian);
  165.       return this;
  166.    }
  167.  
  168.    public ShortBuffer asShortBuffer() {
  169.       int var1 = this.remaining() >> 1;
  170.       int var2 = this.offset + this.position();
  171.       return (ShortBuffer)(this.bigEndian ? new ByteBufferAsShortBufferB(this, -1, 0, var1, var1, var2) : new ByteBufferAsShortBufferL(this, -1, 0, var1, var1, var2));
  172.    }
  173.  
  174.    public int getInt() {
  175.       return Bits.getInt(this, this.method_0(this.nextGetIndex(4)), this.bigEndian);
  176.    }
  177.  
  178.    public int getInt(int var1) {
  179.       return Bits.getInt(this, this.method_0(this.checkIndex(var1, 4)), this.bigEndian);
  180.    }
  181.  
  182.    public ByteBuffer putInt(int var1) {
  183.       Bits.putInt(this, this.method_0(this.nextPutIndex(4)), var1, this.bigEndian);
  184.       return this;
  185.    }
  186.  
  187.    public ByteBuffer putInt(int var1, int var2) {
  188.       Bits.putInt(this, this.method_0(this.checkIndex(var1, 4)), var2, this.bigEndian);
  189.       return this;
  190.    }
  191.  
  192.    public IntBuffer asIntBuffer() {
  193.       int var1 = this.remaining() >> 2;
  194.       int var2 = this.offset + this.position();
  195.       return (IntBuffer)(this.bigEndian ? new ByteBufferAsIntBufferB(this, -1, 0, var1, var1, var2) : new ByteBufferAsIntBufferL(this, -1, 0, var1, var1, var2));
  196.    }
  197.  
  198.    public long getLong() {
  199.       return Bits.getLong(this, this.method_0(this.nextGetIndex(8)), this.bigEndian);
  200.    }
  201.  
  202.    public long getLong(int var1) {
  203.       return Bits.getLong(this, this.method_0(this.checkIndex(var1, 8)), this.bigEndian);
  204.    }
  205.  
  206.    public ByteBuffer putLong(long var1) {
  207.       Bits.putLong(this, this.method_0(this.nextPutIndex(8)), var1, this.bigEndian);
  208.       return this;
  209.    }
  210.  
  211.    public ByteBuffer putLong(int var1, long var2) {
  212.       Bits.putLong(this, this.method_0(this.checkIndex(var1, 8)), var2, this.bigEndian);
  213.       return this;
  214.    }
  215.  
  216.    public LongBuffer asLongBuffer() {
  217.       int var1 = this.remaining() >> 3;
  218.       int var2 = this.offset + this.position();
  219.       return (LongBuffer)(this.bigEndian ? new ByteBufferAsLongBufferB(this, -1, 0, var1, var1, var2) : new ByteBufferAsLongBufferL(this, -1, 0, var1, var1, var2));
  220.    }
  221.  
  222.    public float getFloat() {
  223.       return Bits.getFloat(this, this.method_0(this.nextGetIndex(4)), this.bigEndian);
  224.    }
  225.  
  226.    public float getFloat(int var1) {
  227.       return Bits.getFloat(this, this.method_0(this.checkIndex(var1, 4)), this.bigEndian);
  228.    }
  229.  
  230.    public ByteBuffer putFloat(float var1) {
  231.       Bits.putFloat(this, this.method_0(this.nextPutIndex(4)), var1, this.bigEndian);
  232.       return this;
  233.    }
  234.  
  235.    public ByteBuffer putFloat(int var1, float var2) {
  236.       Bits.putFloat(this, this.method_0(this.checkIndex(var1, 4)), var2, this.bigEndian);
  237.       return this;
  238.    }
  239.  
  240.    public FloatBuffer asFloatBuffer() {
  241.       int var1 = this.remaining() >> 2;
  242.       int var2 = this.offset + this.position();
  243.       return (FloatBuffer)(this.bigEndian ? new ByteBufferAsFloatBufferB(this, -1, 0, var1, var1, var2) : new ByteBufferAsFloatBufferL(this, -1, 0, var1, var1, var2));
  244.    }
  245.  
  246.    public double getDouble() {
  247.       return Bits.getDouble(this, this.method_0(this.nextGetIndex(8)), this.bigEndian);
  248.    }
  249.  
  250.    public double getDouble(int var1) {
  251.       return Bits.getDouble(this, this.method_0(this.checkIndex(var1, 8)), this.bigEndian);
  252.    }
  253.  
  254.    public ByteBuffer putDouble(double var1) {
  255.       Bits.putDouble(this, this.method_0(this.nextPutIndex(8)), var1, this.bigEndian);
  256.       return this;
  257.    }
  258.  
  259.    public ByteBuffer putDouble(int var1, double var2) {
  260.       Bits.putDouble(this, this.method_0(this.checkIndex(var1, 8)), var2, this.bigEndian);
  261.       return this;
  262.    }
  263.  
  264.    public DoubleBuffer asDoubleBuffer() {
  265.       int var1 = this.remaining() >> 3;
  266.       int var2 = this.offset + this.position();
  267.       return (DoubleBuffer)(this.bigEndian ? new ByteBufferAsDoubleBufferB(this, -1, 0, var1, var1, var2) : new ByteBufferAsDoubleBufferL(this, -1, 0, var1, var1, var2));
  268.    }
  269. }
  270.