org.neuclear.commons.crypto.channels
Class AbstractCryptoChannel

java.lang.Object
  extended by org.neuclear.commons.crypto.channels.AbstractCryptoChannel
All Implemented Interfaces:
java.io.Closeable, java.nio.channels.Channel, java.nio.channels.WritableByteChannel
Direct Known Subclasses:
AbstractEncodingChannel, AbstractSignatureChannel, CipherChannel, DigestChannel

public abstract class AbstractCryptoChannel
extends java.lang.Object
implements java.nio.channels.WritableByteChannel

An abstract Channel class used to build various crypto related Channels


Field Summary
protected  boolean closed
           
 
Constructor Summary
protected AbstractCryptoChannel()
           
 
Method Summary
 void close()
           
 boolean isOpen()
           
 void pipe(AbstractCryptoChannel channel)
          Convenience method for linking together multiple AbstractCryptoChannels into a Crypto pipeline.
 void pipe(java.nio.channels.ReadableByteChannel channel)
          Read and process all data from a given pipe.
 java.nio.channels.Pipe.SourceChannel source()
          Gets the Readable channel for reading the output of this channel.
protected  int write(byte[] data)
          Used by sub classes to write byte arrays to the output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.nio.channels.WritableByteChannel
write
 

Field Detail

closed

protected boolean closed
Constructor Detail

AbstractCryptoChannel

protected AbstractCryptoChannel()
                         throws java.io.IOException
Throws:
java.io.IOException
Method Detail

isOpen

public boolean isOpen()
Specified by:
isOpen in interface java.nio.channels.Channel

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Specified by:
close in interface java.nio.channels.Channel
Throws:
java.io.IOException

source

public java.nio.channels.Pipe.SourceChannel source()
Gets the Readable channel for reading the output of this channel.

Returns:

write

protected int write(byte[] data)
             throws java.io.IOException
Used by sub classes to write byte arrays to the output.

Parameters:
data -
Returns:
Throws:
java.io.IOException

pipe

public void pipe(java.nio.channels.ReadableByteChannel channel)
          throws java.io.IOException
Read and process all data from a given pipe. This closes the input channel when end of stream is reached.

Parameters:
channel -
Throws:
java.io.IOException

pipe

public void pipe(AbstractCryptoChannel channel)
          throws java.io.IOException
Convenience method for linking together multiple AbstractCryptoChannels into a Crypto pipeline.

Parameters:
channel -
Throws:
java.io.IOException


Copyright © 2003-2004 Antilles Software Ventures SA. All Rights Reserved.