/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.common.mime.NoSuchPartException
 *  com.l7tech.common.mime.PartInfo
 *  com.l7tech.util.IOUtils
 *  com.l7tech.util.ResourceUtils
 */
package com.l7tech.server.policy.assertion;

import com.l7tech.common.mime.NoSuchPartException;
import com.l7tech.common.mime.PartInfo;
import com.l7tech.server.policy.assertion.ServerRegex;
import com.l7tech.server.policy.assertion.ai;
import com.l7tech.util.IOUtils;
import com.l7tech.util.ResourceUtils;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;

class af
implements ai {
    final PartInfo val$part;
    final Charset val$encoding;
    final ServerRegex this$0;

    /*
     * Ignored method signature, as it can't be verified against descriptor
     */
    af(ServerRegex serverRegex, PartInfo partInfo, Charset charset) {
        this.this$0 = serverRegex;
        this.val$part = partInfo;
        this.val$encoding = charset;
    }

    @Override
    public CharSequence getInput() throws IOException {
        String string;
        InputStream inputStream = null;
        try {
            this.this$0.close();
            byte[] byArray = this.val$part.getBytesIfAlreadyAvailable();
            if (byArray == null) {
                inputStream = this.val$part.getInputStream(false);
                byArray = IOUtils.slurpStream((InputStream)inputStream);
            }
            string = new String(byArray, this.val$encoding);
        }
        catch (NoSuchPartException noSuchPartException) {
            try {
                throw new IOException(noSuchPartException);
            }
            catch (Throwable throwable) {
                ResourceUtils.closeQuietly(inputStream);
                throw throwable;
            }
        }
        ResourceUtils.closeQuietly((Closeable)inputStream);
        return string;
    }
}

