package org.bouncycastle.bcpg;

import java.io.IOException;
import org.bouncycastle.util.Arrays;

/* JADX INFO: loaded from: classes.dex */
public class UnknownPacket extends ContainedPacket {
    private final byte[] contents;

    public UnknownPacket(int i, BCPGInputStream bCPGInputStream) throws IOException {
        this(i, bCPGInputStream, false);
    }

    public UnknownPacket(int i, BCPGInputStream bCPGInputStream, boolean z) throws IOException {
        super(i, z);
        this.contents = bCPGInputStream.readAll();
    }

    @Override // org.bouncycastle.bcpg.ContainedPacket
    public void encode(BCPGOutputStream bCPGOutputStream) throws IOException {
        bCPGOutputStream.writePacket(hasNewPacketFormat(), getPacketTag(), this.contents);
    }

    public byte[] getContents() {
        return Arrays.clone(this.contents);
    }
}
