org.mpisws.p2p.transport.rc4
Class EncryptedSocket<Identifier>
java.lang.Object
org.mpisws.p2p.transport.util.SocketWrapperSocket<Identifier,Identifier>
org.mpisws.p2p.transport.rc4.EncryptedSocket<Identifier>
- All Implemented Interfaces:
- P2PSocket<Identifier>, P2PSocketReceiver<Identifier>
public class EncryptedSocket<Identifier>
- extends SocketWrapperSocket<Identifier,Identifier>
|
Method Summary |
long |
read(ByteBuffer output)
Reads a sequence of bytes from this channel into a subsequence of the given buffer. |
void |
receiveSelectResult(P2PSocket<Identifier> socket,
boolean canRead,
boolean canWrite)
Called when a socket is available for read/write |
long |
write(ByteBuffer srcs)
Writes a sequence of bytes to this channel from a subsequence of the given buffers. |
protected long |
writeHelper(ByteBuffer srcs)
Only to be called holding the encryptedWriteBuffer, probably should only be called from this.write() |
encryptCipher
public Cipher encryptCipher
decryptCipher
public Cipher decryptCipher
EncryptedSocket
public EncryptedSocket(Identifier identifier,
P2PSocket<Identifier> socket,
Logger logger,
ErrorHandler<Identifier> handler,
Map<String,Object> options,
Cipher encryptCipher,
Cipher decryptCipher,
int writeBufferSize)
read
public long read(ByteBuffer output)
throws IOException
- Description copied from interface:
P2PSocket
- Reads a sequence of bytes from this channel into a subsequence of the given buffer.
- Specified by:
read in interface P2PSocket<Identifier>- Overrides:
read in class SocketWrapperSocket<Identifier,Identifier>
- Returns:
-
- Throws:
IOException
write
public long write(ByteBuffer srcs)
throws IOException
- Description copied from interface:
P2PSocket
- Writes a sequence of bytes to this channel from a subsequence of the given buffers.
- Specified by:
write in interface P2PSocket<Identifier>- Overrides:
write in class SocketWrapperSocket<Identifier,Identifier>
- Throws:
IOException
writeHelper
protected long writeHelper(ByteBuffer srcs)
throws IOException
- Only to be called holding the encryptedWriteBuffer, probably should only be called from this.write()
- Parameters:
srcs -
- Returns:
-
- Throws:
IOException
receiveSelectResult
public void receiveSelectResult(P2PSocket<Identifier> socket,
boolean canRead,
boolean canWrite)
throws IOException
- Description copied from interface:
P2PSocketReceiver
- Called when a socket is available for read/write
- Specified by:
receiveSelectResult in interface P2PSocketReceiver<Identifier>- Overrides:
receiveSelectResult in class SocketWrapperSocket<Identifier,Identifier>
- Throws:
IOException
Copyright © 2010. All Rights Reserved.