|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.freecompany.redline.ChannelWrapper
public abstract class ChannelWrapper
Wraps an IO channel so that bytes may be observed during transmission. Wrappers around IO channels are used for a variety of purposes, including counting byte output for use in generating headers, calculating a signature across output bytes, and digesting output bytes using a one-way secure hash.
| Nested Class Summary | |
|---|---|
protected static interface |
ChannelWrapper.Consumer<T>
Interface describing an object that consumes data from a NIO buffer. |
static class |
ChannelWrapper.Key<T>
|
| Field Summary | |
|---|---|
protected Map<ChannelWrapper.Key<?>,ChannelWrapper.Consumer<?>> |
consumers
|
| Constructor Summary | |
|---|---|
ChannelWrapper()
|
|
| Method Summary | ||
|---|---|---|
void |
close()
|
|
|
finish(ChannelWrapper.Key<T> object)
|
|
ChannelWrapper.Key<Integer> |
start()
Initializes a byte counter on this channel. |
|
ChannelWrapper.Key<byte[]> |
start(org.bouncycastle.openpgp.PGPPrivateKey key,
int algorithm)
Initialize a PGP signatue on the channel |
|
ChannelWrapper.Key<byte[]> |
start(PrivateKey key)
Initialize a signature on this channel. |
|
ChannelWrapper.Key<byte[]> |
start(String algorithm)
Initialize a digest on this channel. |
|
ChannelWrapper.Key<Integer> |
start(WritableByteChannel output)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Map<ChannelWrapper.Key<?>,ChannelWrapper.Consumer<?>> consumers
| Constructor Detail |
|---|
public ChannelWrapper()
| Method Detail |
|---|
public ChannelWrapper.Key<Integer> start(WritableByteChannel output)
public ChannelWrapper.Key<Integer> start()
public ChannelWrapper.Key<byte[]> start(PrivateKey key)
throws NoSuchAlgorithmException,
InvalidKeyException
key - the private key to use in signing this data stream.
NoSuchAlgorithmException - if the key algorithm is not supported
InvalidKeyException - if the key provided is invalid for signing
public ChannelWrapper.Key<byte[]> start(org.bouncycastle.openpgp.PGPPrivateKey key,
int algorithm)
key - the private key to use in signing this data stream.algorithm - the algorithm to use. Can be extracted from public key.
org.bouncycastle.openpgp.PGPException - if something with PGP got wrong
public ChannelWrapper.Key<byte[]> start(String algorithm)
throws NoSuchAlgorithmException
algorithm - the digest algorithm to use in computing the hash
NoSuchAlgorithmException - if the given algorithm does not existpublic <T> T finish(ChannelWrapper.Key<T> object)
public void close()
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||