org.norther.tammi.acorn.nio
Interface SecureChannel

All Superinterfaces:
Channel, Closeable
All Known Implementing Classes:
SSLSocketChannel

public interface SecureChannel
extends Channel

An interface to secure channels. It is usually recommended to perform the initial SSL handshake with the separate handshake method, although the implementation may support embedded handshaking within the read and write methods. The shutdown process may also be started separately but should be called automatically by the close method of the implementation.

Author:
Ilkka Priha

Method Summary
 int decrypted()
          Returns the number of decrypted bytes not yet read.
 int encrypted()
          Returns the number of encrypted bytes not yet flushed.
 boolean finished()
          Returns true if this channel is finished with handshaking.
 void flush()
          Flushes remaining encrypted bytes if any.
 int handshake(int ops)
          Starts or continues handshaking with the specified operations.
 boolean shutdown()
          Starts the shutdown sequence but does not close the channel.
 
Methods inherited from interface java.nio.channels.Channel
close, isOpen
 

Method Detail

finished

boolean finished()
Returns true if this channel is finished with handshaking.

Returns:
true if finished, false otherwise.

encrypted

int encrypted()
Returns the number of encrypted bytes not yet flushed.

Returns:
the number of encrypted bytes.

decrypted

int decrypted()
Returns the number of decrypted bytes not yet read.

Returns:
the number of decrypted bytes.

handshake

int handshake(int ops)
              throws IOException
Starts or continues handshaking with the specified operations.

Parameters:
ops - the current ready operations set.
Returns:
the interest set to continue or 0 if finished.
Throws:
IOException - on I/O errors.

shutdown

boolean shutdown()
                 throws IOException
Starts the shutdown sequence but does not close the channel.

Returns:
true if finished, false otherwise.
Throws:
IOException - on I/O errors.

flush

void flush()
           throws IOException
Flushes remaining encrypted bytes if any.

Throws:
IOException - on I/O errors.


Copyright © 2004 The Norther Organization. All rights reserved.