package com.l7tech.message;

import com.l7tech.common.mime.ContentTypeHeader;
import com.l7tech.common.mime.MimeBody;
import com.l7tech.common.mime.NoSuchPartException;
import com.l7tech.common.mime.PartInfo;
import com.l7tech.common.mime.PartIterator;
import com.l7tech.util.CausedIOException;
import java.io.IOException;
import java.io.InputStream;

final class h implements MimeKnob {
   final d this$0;

   private h(d var1) {
      this.this$0 = var1;
   }

   @Override
   public boolean isMultipart() {
      return this.a().isMultipart();
   }

   @Override
   public PartIterator getParts() {
      return this.a().iterator();
   }

   @Override
   public PartIterator iterator() {
      return this.getParts();
   }

   @Override
   public PartInfo getPart(int var1) throws IOException, NoSuchPartException {
      return this.a().getPart(var1);
   }

   private MimeBody a() {
      return this.this$0.c;
   }

   @Override
   public PartInfo getPartByContentId(String var1) throws IOException, NoSuchPartException {
      return this.a().getPartByContentId(var1);
   }

   @Override
   public void setContentLengthLimit(long var1) throws IOException {
      this.a().setBodyLengthLimit(var1);
   }

   @Override
   public long getContentLengthLimit() {
      return this.a().getBodyLengthLimit();
   }

   @Override
   public ContentTypeHeader getOuterContentType() {
      return this.a().getOuterContentType();
   }

   @Override
   public void setOuterContentType(ContentTypeHeader var1) {
      this.a().setOuterContentType(var1);
   }

   @Override
   public long getContentLength() throws IOException {
      try {
         return this.a().getEntireMessageBodyLength();
      } catch (NoSuchPartException var2) {
         throw new CausedIOException(var2);
      }
   }

   @Override
   public void setStreamValidatedPartsOnly() {
      this.a().setEntireMessageBodyAsInputStreamIsValidatedOnly();
   }

   @Override
   public InputStream getEntireMessageBodyAsInputStream() throws IOException, NoSuchPartException {
      return this.a().getEntireMessageBodyAsInputStream(this.this$0.d);
   }

   @Override
   public InputStream getEntireMessageBodyAsInputStream(boolean param1) throws IOException, NoSuchPartException {
      // $VF: Couldn't be decompiled
      // Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!)
      // java.lang.RuntimeException: parsing failure!
      //   at org.jetbrains.java.decompiler.modules.decompiler.decompose.DomHelper.parseGraph(DomHelper.java:211)
      //   at org.jetbrains.java.decompiler.main.rels.MethodProcessor.codeToJava(MethodProcessor.java:174)
      //
      // Bytecode:
      // 00: aload 0
      // 01: invokevirtual com/l7tech/message/h.a ()Lcom/l7tech/common/mime/MimeBody;
      // 04: iload 1
      // 05: ifne 19
      // 08: aload 0
      // 09: getfield com/l7tech/message/h.this$0 Lcom/l7tech/message/d;
      // 0c: getfield com/l7tech/message/d.d Z
      // 0f: ifeq 21
      // 12: goto 19
      // 15: invokestatic com/l7tech/message/h.a (Ljava/io/IOException;)Ljava/io/IOException;
      // 18: athrow
      // 19: bipush 1
      // 1a: goto 22
      // 1d: invokestatic com/l7tech/message/h.a (Ljava/io/IOException;)Ljava/io/IOException;
      // 20: athrow
      // 21: bipush 0
      // 22: invokevirtual com/l7tech/common/mime/MimeBody.getEntireMessageBodyAsInputStream (Z)Ljava/io/InputStream;
      // 25: areturn
      // try (0 -> 8): 9 java/io/IOException
      // try (4 -> 13): 13 java/io/IOException
   }

   @Override
   public PartInfo getFirstPart() {
      return this.a().getFirstPart();
   }

   @Override
   public void setBufferingDisallowed(boolean var1) {
      this.this$0.d = var1;
   }

   @Override
   public boolean isBufferingDisallowed() {
      return this.this$0.d;
   }

   private static IOException a(IOException var0) {
      return var0;
   }
}
