package net.gotev.uploadservice;

import android.os.Parcel;
import android.os.Parcelable;
import java.util.LinkedHashMap;
/* loaded from: classes.dex */
public class ServerResponse implements Parcelable {
    public static final Parcelable.Creator<ServerResponse> CREATOR = new Parcelable.Creator<ServerResponse>() { // from class: net.gotev.uploadservice.ServerResponse.1
        @Override // android.os.Parcelable.Creator
        public ServerResponse createFromParcel(Parcel parcel) {
            return new ServerResponse(parcel);
        }

        @Override // android.os.Parcelable.Creator
        public ServerResponse[] newArray(int i) {
            return new ServerResponse[i];
        }
    };
    private byte[] body;
    private LinkedHashMap<String, String> headers;
    private int httpCode;

    @Override // android.os.Parcelable
    public int describeContents() {
        return 0;
    }

    public ServerResponse(int i, byte[] bArr, LinkedHashMap<String, String> linkedHashMap) {
        this.httpCode = i;
        if (bArr != null && bArr.length > 0) {
            this.body = bArr;
        } else {
            this.body = new byte[1];
        }
        if (linkedHashMap != null && !linkedHashMap.isEmpty()) {
            this.headers = linkedHashMap;
        } else {
            this.headers = new LinkedHashMap<>(1);
        }
    }

    protected ServerResponse(Parcel parcel) {
        this.httpCode = parcel.readInt();
        byte[] bArr = new byte[parcel.readInt()];
        this.body = bArr;
        parcel.readByteArray(bArr);
        this.headers = (LinkedHashMap) parcel.readSerializable();
    }

    @Override // android.os.Parcelable
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeInt(this.httpCode);
        parcel.writeInt(this.body.length);
        parcel.writeByteArray(this.body);
        parcel.writeSerializable(this.headers);
    }

    public int getHttpCode() {
        return this.httpCode;
    }

    public byte[] getBody() {
        return this.body;
    }

    public String getBodyAsString() {
        return new String(this.body);
    }

    public LinkedHashMap<String, String> getHeaders() {
        return this.headers;
    }
}
