home *** CD-ROM | disk | FTP | other *** search
- package java.io;
-
- public class CharArrayReader extends Reader {
- protected char[] buf;
- protected int pos;
- protected int markedPos;
- protected int count;
-
- public CharArrayReader(char[] var1) {
- this.buf = var1;
- this.pos = 0;
- this.count = var1.length;
- }
-
- public CharArrayReader(char[] var1, int var2, int var3) {
- this.buf = var1;
- this.pos = var2;
- this.count = Math.min(var2 + var3, var1.length);
- }
-
- private void ensureOpen() throws IOException {
- if (this.buf == null) {
- throw new IOException("Stream closed");
- }
- }
-
- public int read() throws IOException {
- Object var2 = super.lock;
- synchronized(var2){}
-
- int var1;
- try {
- this.ensureOpen();
- if (this.pos < this.count) {
- var1 = this.buf[this.pos++];
- return var1;
- }
-
- var1 = -1;
- } catch (Throwable var5) {
- throw var5;
- }
-
- return var1;
- }
-
- public int read(char[] var1, int var2, int var3) throws IOException {
- Object var5 = super.lock;
- synchronized(var5){}
-
- int var4;
- try {
- this.ensureOpen();
- if (this.pos >= this.count) {
- var4 = (byte)-1;
- return var4;
- }
-
- if (this.pos + var3 > this.count) {
- var3 = this.count - this.pos;
- }
-
- if (var3 > 0) {
- System.arraycopy(this.buf, this.pos, var1, var2, var3);
- this.pos += var3;
- var4 = var3;
- return var4;
- }
-
- var4 = 0;
- } catch (Throwable var8) {
- throw var8;
- }
-
- return var4;
- }
-
- public long skip(long var1) throws IOException {
- Object var5 = super.lock;
- synchronized(var5){}
-
- long var3;
- try {
- this.ensureOpen();
- if ((long)this.pos + var1 > (long)this.count) {
- var1 = (long)(this.count - this.pos);
- }
-
- if (var1 >= 0L) {
- this.pos = (int)((long)this.pos + var1);
- var3 = var1;
- return var3;
- }
-
- var3 = 0L;
- } catch (Throwable var8) {
- throw var8;
- }
-
- return var3;
- }
-
- public boolean ready() throws IOException {
- Object var2 = super.lock;
- synchronized(var2){}
-
- boolean var1;
- try {
- this.ensureOpen();
- var1 = this.count - this.pos > 0;
- } catch (Throwable var5) {
- throw var5;
- }
-
- return var1;
- }
-
- public boolean markSupported() {
- return true;
- }
-
- public void mark(int var1) throws IOException {
- Object var2 = super.lock;
- synchronized(var2){}
-
- try {
- this.ensureOpen();
- this.markedPos = this.pos;
- } catch (Throwable var4) {
- throw var4;
- }
-
- }
-
- public void reset() throws IOException {
- Object var1 = super.lock;
- synchronized(var1){}
-
- try {
- this.ensureOpen();
- this.pos = this.markedPos;
- } catch (Throwable var3) {
- throw var3;
- }
-
- }
-
- public void close() {
- this.buf = null;
- }
- }
-