InputByteStreamImpl.java 3.6 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.internal.io.stream;

import com.adobe.internal.io.stream.InputByteStream;
import com.adobe.internal.io.stream.InputStreamImpl;
import java.io.IOException;
import java.io.InputStream;

public abstract class InputByteStreamImpl
implements InputByteStream {
    protected int mark = 0;

    protected InputByteStreamImpl() {
    }

    @Override
    public abstract InputByteStream slice(long var1, long var3) throws IOException;

    @Override
    public InputByteStream slice() throws IOException {
        return this.slice(0, this.length());
    }

    @Override
    public abstract int read() throws IOException;

    @Override
    public abstract int read(byte[] var1, int var2, int var3) throws IOException;

    @Override
    public int read(byte[] bytes) throws IOException {
        return this.read(bytes, 0, bytes.length);
    }

    @Override
    public int unget() throws IOException {
        this.seek(this.getPosition() - 1);
        int byteRead = this.read();
        this.seek(this.getPosition() - 1);
        return byteRead;
    }

    @Override
    public abstract InputByteStream seek(long var1) throws IOException;

    @Override
    public abstract long getPosition() throws IOException;

    @Override
    public abstract long length() throws IOException;

    @Override
    public long bytesAvailable() throws IOException {
        return this.length() - this.getPosition();
    }

    @Override
    public boolean eof() throws IOException {
        return this.getPosition() >= this.length();
    }

    @Override
    public abstract void close() throws IOException;

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     * Unable to fully structure code
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     * Lifted jumps to return sites
     */
    public String toString() {
        block14 : {
            message = null;
            buf = new byte[100];
            slice = null;
            slice = this.slice(this.getPosition(), Math.min(this.length() - this.getPosition(), (long)buf.length));
            slice.read(buf);
            try {
                if (slice != null) {
                    slice.close();
                }
                break block14;
            }
            catch (IOException e) {}
            ** GOTO lbl30
            catch (IOException e) {
                try {
                    if (slice != null) {
                        slice.close();
                    }
                }
                catch (IOException e) {}
                catch (Throwable var5_9) {
                    try {
                        if (slice == null) throw var5_9;
                        slice.close();
                        throw var5_9;
                    }
                    catch (IOException e) {
                        // empty catch block
                    }
                    throw var5_9;
                }
            }
        }
        try {
            message = new StringBuilder("InputByteStream [ position = ").append(this.getPosition()).append(", limit = ").append(this.length()).append(", available = ").append(this.bytesAvailable()).append(", mark = ").append(this.mark).append(" ] ").append(new String(buf, "US-ASCII"));
            return message.toString();
        }
        catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public InputStream toInputStream() throws IOException {
        InputByteStream ibs = this.slice();
        return new InputStreamImpl(ibs);
    }
}