Example usage for org.bouncycastle.bcpg BCPGInputStream readPacket

List of usage examples for org.bouncycastle.bcpg BCPGInputStream readPacket

Introduction

In this page you can find the example usage for org.bouncycastle.bcpg BCPGInputStream readPacket.

Prototype

public Packet readPacket() throws IOException 

Source Link

Document

Reads the next packet from the stream.

Usage

From source file:org.sufficientlysecure.keychain.pgp.WrappedUserAttribute.java

License:Open Source License

private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {

    byte[] data = (byte[]) in.readObject();
    BCPGInputStream bcpg = new BCPGInputStream(new ByteArrayInputStream(data));
    Packet p = bcpg.readPacket();
    if (!UserAttributePacket.class.isInstance(p)) {
        throw new IOException("Could not decode UserAttributePacket!");
    }//w ww  . j a  v  a 2  s.  c  o  m
    mVector = new PGPUserAttributeSubpacketVector(((UserAttributePacket) p).getSubpackets());

}