package com.l7tech.common.http.prov.jdk;

import com.l7tech.common.http.GenericHttpException;
import com.l7tech.common.http.GenericHttpHeaders;
import com.l7tech.common.http.GenericHttpResponse;
import com.l7tech.common.http.HttpHeaders;
import com.l7tech.common.mime.ContentTypeHeader;
import java.io.IOException;
import java.io.InputStream;

class a extends GenericHttpResponse {
   final int val$status;
   final GenericHttpHeaders val$genericHttpHeaders;
   final ContentTypeHeader val$contentTypeHeader;
   final b this$1;

   a(b var1, int var2, GenericHttpHeaders var3, ContentTypeHeader var4) {
      this.this$1 = var1;
      this.val$status = var2;
      this.val$genericHttpHeaders = var3;
      this.val$contentTypeHeader = var4;
   }

   @Override
   public InputStream getInputStream() throws GenericHttpException {
      InputStream var1;
      try {
         var1 = this.this$1.val$conn.getInputStream();
      } catch (IOException var4) {
         IOException var2 = var4;
         var1 = this.this$1.val$httpConn.getErrorStream();

         try {
            if (var1 == null) {
               throw new GenericHttpException(var2);
            }
         } catch (IOException var3) {
            throw a(var3);
         }
      }

      return var1;
   }

   @Override
   public int getStatus() {
      return this.val$status;
   }

   @Override
   public HttpHeaders getHeaders() {
      return this.val$genericHttpHeaders;
   }

   @Override
   public ContentTypeHeader getContentType() {
      return this.val$contentTypeHeader;
   }

   @Override
   public Long getContentLength() {
      return (long)this.this$1.val$conn.getContentLength();
   }

   @Override
   public void close() {
      this.this$1.val$httpConn.disconnect();
   }

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