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 / io / Reader.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  1.4 KB  |  86 lines

  1. package java.io;
  2.  
  3. import java.nio.CharBuffer;
  4.  
  5. public abstract class Reader implements Readable, Closeable {
  6.    protected Object lock;
  7.    private static final int maxSkipBufferSize = 8192;
  8.    private char[] skipBuffer = null;
  9.  
  10.    protected Reader() {
  11.       this.lock = this;
  12.    }
  13.  
  14.    protected Reader(Object var1) {
  15.       if (var1 == null) {
  16.          throw new NullPointerException();
  17.       } else {
  18.          this.lock = var1;
  19.       }
  20.    }
  21.  
  22.    public int read(CharBuffer var1) throws IOException {
  23.       int var2 = var1.remaining();
  24.       char[] var3 = new char[var2];
  25.       int var4 = this.read(var3, 0, var2);
  26.       if (var4 > 0) {
  27.          var1.put(var3, 0, var4);
  28.       }
  29.  
  30.       return var4;
  31.    }
  32.  
  33.    public int read() throws IOException {
  34.       char[] var1 = new char[1];
  35.       return this.read(var1, 0, 1) == -1 ? -1 : var1[0];
  36.    }
  37.  
  38.    public int read(char[] var1) throws IOException {
  39.       return this.read(var1, 0, var1.length);
  40.    }
  41.  
  42.    public abstract int read(char[] var1, int var2, int var3) throws IOException;
  43.  
  44.    public long skip(long var1) throws IOException {
  45.       if (var1 < 0L) {
  46.          throw new IllegalArgumentException("skip value is negative");
  47.       } else {
  48.          int var3 = (int)Math.min(var1, 8192L);
  49.          synchronized(this.lock) {
  50.             if (this.skipBuffer == null || this.skipBuffer.length < var3) {
  51.                this.skipBuffer = new char[var3];
  52.             }
  53.  
  54.             long var5;
  55.             int var7;
  56.             for(var5 = var1; var5 > 0L; var5 -= (long)var7) {
  57.                var7 = this.read(this.skipBuffer, 0, (int)Math.min(var5, (long)var3));
  58.                if (var7 == -1) {
  59.                   break;
  60.                }
  61.             }
  62.  
  63.             return var1 - var5;
  64.          }
  65.       }
  66.    }
  67.  
  68.    public boolean ready() throws IOException {
  69.       return false;
  70.    }
  71.  
  72.    public boolean markSupported() {
  73.       return false;
  74.    }
  75.  
  76.    public void mark(int var1) throws IOException {
  77.       throw new IOException("mark() not supported");
  78.    }
  79.  
  80.    public void reset() throws IOException {
  81.       throw new IOException("reset() not supported");
  82.    }
  83.  
  84.    public abstract void close() throws IOException;
  85. }
  86.