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 / Buffer.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  1.8 KB  |  185 lines

  1. package java.nio;
  2.  
  3. public abstract class Buffer {
  4.    private int mark = -1;
  5.    private int position = 0;
  6.    private int limit;
  7.    private int capacity;
  8.    long address;
  9.  
  10.    Buffer(int var1, int var2, int var3, int var4) {
  11.       if (var4 < 0) {
  12.          throw new IllegalArgumentException();
  13.       } else {
  14.          this.capacity = var4;
  15.          this.limit(var3);
  16.          this.position(var2);
  17.          if (var1 >= 0) {
  18.             if (var1 > var2) {
  19.                throw new IllegalArgumentException();
  20.             }
  21.  
  22.             this.mark = var1;
  23.          }
  24.  
  25.       }
  26.    }
  27.  
  28.    public final int capacity() {
  29.       return this.capacity;
  30.    }
  31.  
  32.    public final int position() {
  33.       return this.position;
  34.    }
  35.  
  36.    public final Buffer position(int var1) {
  37.       if (var1 <= this.limit && var1 >= 0) {
  38.          this.position = var1;
  39.          if (this.mark > this.position) {
  40.             this.mark = -1;
  41.          }
  42.  
  43.          return this;
  44.       } else {
  45.          throw new IllegalArgumentException();
  46.       }
  47.    }
  48.  
  49.    public final int limit() {
  50.       return this.limit;
  51.    }
  52.  
  53.    public final Buffer limit(int var1) {
  54.       if (var1 <= this.capacity && var1 >= 0) {
  55.          this.limit = var1;
  56.          if (this.position > this.limit) {
  57.             this.position = this.limit;
  58.          }
  59.  
  60.          if (this.mark > this.limit) {
  61.             this.mark = -1;
  62.          }
  63.  
  64.          return this;
  65.       } else {
  66.          throw new IllegalArgumentException();
  67.       }
  68.    }
  69.  
  70.    public final Buffer mark() {
  71.       this.mark = this.position;
  72.       return this;
  73.    }
  74.  
  75.    public final Buffer reset() {
  76.       int var1 = this.mark;
  77.       if (var1 < 0) {
  78.          throw new InvalidMarkException();
  79.       } else {
  80.          this.position = var1;
  81.          return this;
  82.       }
  83.    }
  84.  
  85.    public final Buffer clear() {
  86.       this.position = 0;
  87.       this.limit = this.capacity;
  88.       this.mark = -1;
  89.       return this;
  90.    }
  91.  
  92.    public final Buffer flip() {
  93.       this.limit = this.position;
  94.       this.position = 0;
  95.       this.mark = -1;
  96.       return this;
  97.    }
  98.  
  99.    public final Buffer rewind() {
  100.       this.position = 0;
  101.       this.mark = -1;
  102.       return this;
  103.    }
  104.  
  105.    public final int remaining() {
  106.       return this.limit - this.position;
  107.    }
  108.  
  109.    public final boolean hasRemaining() {
  110.       return this.position < this.limit;
  111.    }
  112.  
  113.    public abstract boolean isReadOnly();
  114.  
  115.    public abstract boolean hasArray();
  116.  
  117.    public abstract Object array();
  118.  
  119.    public abstract int arrayOffset();
  120.  
  121.    public abstract boolean isDirect();
  122.  
  123.    final int nextGetIndex() {
  124.       if (this.position >= this.limit) {
  125.          throw new BufferUnderflowException();
  126.       } else {
  127.          return this.position++;
  128.       }
  129.    }
  130.  
  131.    final int nextGetIndex(int var1) {
  132.       if (this.limit - this.position < var1) {
  133.          throw new BufferUnderflowException();
  134.       } else {
  135.          int var2 = this.position;
  136.          this.position += var1;
  137.          return var2;
  138.       }
  139.    }
  140.  
  141.    final int nextPutIndex() {
  142.       if (this.position >= this.limit) {
  143.          throw new BufferOverflowException();
  144.       } else {
  145.          return this.position++;
  146.       }
  147.    }
  148.  
  149.    final int nextPutIndex(int var1) {
  150.       if (this.limit - this.position < var1) {
  151.          throw new BufferOverflowException();
  152.       } else {
  153.          int var2 = this.position;
  154.          this.position += var1;
  155.          return var2;
  156.       }
  157.    }
  158.  
  159.    final int checkIndex(int var1) {
  160.       if (var1 >= 0 && var1 < this.limit) {
  161.          return var1;
  162.       } else {
  163.          throw new IndexOutOfBoundsException();
  164.       }
  165.    }
  166.  
  167.    final int checkIndex(int var1, int var2) {
  168.       if (var1 >= 0 && var2 <= this.limit - var1) {
  169.          return var1;
  170.       } else {
  171.          throw new IndexOutOfBoundsException();
  172.       }
  173.    }
  174.  
  175.    final int markValue() {
  176.       return this.mark;
  177.    }
  178.  
  179.    static void checkBounds(int var0, int var1, int var2) {
  180.       if ((var0 | var1 | var0 + var1 | var2 - (var0 + var1)) < 0) {
  181.          throw new IndexOutOfBoundsException();
  182.       }
  183.    }
  184. }
  185.