// 
// Decompiled by Procyon v0.6.0
// 

package org.jline.utils;

import java.io.IOException;
import java.io.Reader;

public abstract class NonBlockingReader extends Reader
{
    public static final int EOF = -1;
    public static final int READ_EXPIRED = -2;
    
    public void shutdown() {
    }
    
    @Override
    public int read() throws IOException {
        return this.read(0L, false);
    }
    
    public int peek(final long timeout) throws IOException {
        return this.read(timeout, true);
    }
    
    public int read(final long timeout) throws IOException {
        return this.read(timeout, false);
    }
    
    @Override
    public int read(final char[] b, final int off, final int len) throws IOException {
        if (b == null) {
            throw new NullPointerException();
        }
        if (off < 0 || len < 0 || len > b.length - off) {
            throw new IndexOutOfBoundsException();
        }
        if (len == 0) {
            return 0;
        }
        final int c = this.read(0L);
        if (c == -1) {
            return -1;
        }
        b[off] = (char)c;
        return 1;
    }
    
    public int readBuffered(final char[] b) throws IOException {
        return this.readBuffered(b, 0L);
    }
    
    public int readBuffered(final char[] b, final long timeout) throws IOException {
        return this.readBuffered(b, 0, b.length, timeout);
    }
    
    public abstract int readBuffered(final char[] p0, final int p1, final int p2, final long p3) throws IOException;
    
    public int available() {
        return 0;
    }
    
    protected abstract int read(final long p0, final boolean p1) throws IOException;
}
