cryptix.pgp
Class PacketInputStream

java.lang.Object
  |
  +--java.io.InputStream
        |
        +--java.io.FilterInputStream
              |
              +--java.io.DataInputStream
                    |
                    +--cryptix.pgp.PacketInputStream
All Implemented Interfaces:
java.io.DataInput

public class PacketInputStream
extends java.io.DataInputStream

Adds readPacket(), readKeyRingEntry() and readUserIdCertificate() methods to DataInputStream.

Also allows ONE packet to be pushed back onto the stream.


Copyright © 1995-1997 Systemics Ltd on behalf of the Cryptix Development Team.
All rights reserved.

$Revision: 1.1.1.1 $

Since:
Cryptix 2.2 or earlier
Author:
Mike Wynn, Ian Brown, Jill Baker

Field Summary
protected  java.io.DataInputStream din
           
protected  Packet store
          Stores a packet that has been pushed back.
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
PacketInputStream(java.io.DataInputStream input)
           
PacketInputStream(java.io.InputStream input)
           
 
Method Summary
 boolean markSupported()
           
 void pushback(Packet p)
          Pushes back a packet which has been read onto the stream.
 Packet readAnyPacket()
          Reads any packet, including comment packets.
 KeyRingEntry readKeyRingEntry(KeyRingTrust defaultTrust)
          Used by KeyRing to load in key certificate and accompanying user IDs and signatures, and KeyServer to decipher keys retrieved from remote keyservers.
 Packet readPacket()
          Reads any packet apart from Comment packets.
 UserIdCertificate readUserIdCertificate(KeyRingTrust defaultTrust)
           
 
Methods inherited from class java.io.DataInputStream
read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, readUTF, skipBytes
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, read, reset, skip
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

store

protected Packet store
Stores a packet that has been pushed back.

din

protected java.io.DataInputStream din
Constructor Detail

PacketInputStream

public PacketInputStream(java.io.InputStream input)

PacketInputStream

public PacketInputStream(java.io.DataInputStream input)
Method Detail

readAnyPacket

public Packet readAnyPacket()
                     throws java.io.IOException
Reads any packet, including comment packets.

readPacket

public Packet readPacket()
                  throws java.io.IOException
Reads any packet apart from Comment packets. This greatly simplifies the processing of packet streams, which can contain Comments anywhere.

pushback

public void pushback(Packet p)
              throws java.io.IOException
Pushes back a packet which has been read onto the stream. This is essential for parsing multi-packet structures such as a KeyRingEntry, where you don't know how many packets of what type to expect.

readKeyRingEntry

public KeyRingEntry readKeyRingEntry(KeyRingTrust defaultTrust)
                              throws java.io.IOException
Used by KeyRing to load in key certificate and accompanying user IDs and signatures, and KeyServer to decipher keys retrieved from remote keyservers.

readUserIdCertificate

public UserIdCertificate readUserIdCertificate(KeyRingTrust defaultTrust)
                                        throws java.io.IOException

markSupported

public boolean markSupported()
Overrides:
markSupported in class java.io.FilterInputStream