package com.l7tech.server.policy.assertion;

import com.l7tech.common.mime.NoSuchPartException;
import com.l7tech.common.mime.PartInfo;
import com.l7tech.util.IOUtils;
import com.l7tech.util.ResourceUtils;
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;

   af(ServerRegex var1, PartInfo var2, Charset var3) {
      this.this$0 = var1;
      this.val$part = var2;
      this.val$encoding = var3;
   }

   @Override
   public CharSequence getInput() throws IOException {
      InputStream var1 = null;

      try {
         this.this$0.close();
         byte[] var2 = this.val$part.getBytesIfAlreadyAvailable();
         if (var2 == null) {
            var2 = IOUtils.slurpStream(var1 = this.val$part.getInputStream(false));
         }

         return new String(var2, this.val$encoding);
      } catch (NoSuchPartException var7) {
         throw new IOException(var7);
      } finally {
         ResourceUtils.closeQuietly(var1);
      }
   }
}
