org.freecompany.redline
Class ChannelWrapper
java.lang.Object
org.freecompany.redline.ChannelWrapper
- Direct Known Subclasses:
- ReadableChannelWrapper, WritableChannelWrapper
public abstract class ChannelWrapper
- extends Object
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.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
consumers
protected Map<ChannelWrapper.Key<?>,ChannelWrapper.Consumer<?>> consumers
ChannelWrapper
public ChannelWrapper()
start
public ChannelWrapper.Key<Integer> start(WritableByteChannel output)
start
public ChannelWrapper.Key<Integer> start()
- Initializes a byte counter on this channel.
start
public ChannelWrapper.Key<byte[]> start(PrivateKey key)
throws NoSuchAlgorithmException,
InvalidKeyException
- Initialize a signature on this channel.
- Parameters:
key - the private key to use in signing this data stream.
- Throws:
NoSuchAlgorithmException - if the key algorithm is not supported
InvalidKeyException - if the key provided is invalid for signing
start
public ChannelWrapper.Key<byte[]> start(String algorithm)
throws NoSuchAlgorithmException
- Initialize a digest on this channel.
- Parameters:
algorithm - the digest algorithm to use in computing the hash
- Throws:
NoSuchAlgorithmException - if the given algorithm does not exist
finish
public <T> T finish(ChannelWrapper.Key<T> object)
close
public void close()
throws IOException
- Throws:
IOException
Copyright © 2012. All Rights Reserved.