anon.shared
Class AbstractChannel

java.lang.Object
  extended by anon.shared.AbstractChannel
All Implemented Interfaces:
AnonChannel
Direct Known Subclasses:
MixminionPOPChannel, MixminionSMTPChannel, TorChannel

public abstract class AbstractChannel
extends java.lang.Object
implements AnonChannel


Field Summary
protected  boolean m_bIsClosed
           
protected  boolean m_bIsClosedByPeer
           
protected  int m_id
           
private  ChannelInputStream m_inputStream
           
private  ChannelOutputStream m_outputStream
           
 
Fields inherited from interface anon.AnonChannel
HTTP, SMTP, SOCKS
 
Constructor Summary
AbstractChannel()
           
AbstractChannel(int id)
           
 
Method Summary
protected abstract  void close_impl()
           
 void close()
          Closes the channel and releases all resources used.
 void closedByPeer()
           
 void finalize()
           
 java.io.InputStream getInputStream()
          The returned InputStream could be used to receive data.
 java.io.OutputStream getOutputStream()
          The returned OutputStream could be used to send data.
 int hashCode()
           
 boolean isClosed()
           
protected  void recv(byte[] buff, int pos, int len)
           
protected abstract  void send(byte[] buff, int len)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface anon.AnonChannel
getOutputBlockSize
 

Field Detail

m_bIsClosedByPeer

protected volatile boolean m_bIsClosedByPeer

m_bIsClosed

protected volatile boolean m_bIsClosed

m_id

protected int m_id

m_inputStream

private ChannelInputStream m_inputStream

m_outputStream

private ChannelOutputStream m_outputStream
Constructor Detail

AbstractChannel

public AbstractChannel(int id)

AbstractChannel

public AbstractChannel()
Method Detail

finalize

public void finalize()
Overrides:
finalize in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getInputStream

public java.io.InputStream getInputStream()
Description copied from interface: AnonChannel
The returned InputStream could be used to receive data.

Specified by:
getInputStream in interface AnonChannel
Returns:
InputStream, useful for receiving data

getOutputStream

public java.io.OutputStream getOutputStream()
Description copied from interface: AnonChannel
The returned OutputStream could be used to send data.

Specified by:
getOutputStream in interface AnonChannel
Returns:
OutputStream, useful for sending data

isClosed

public boolean isClosed()
Specified by:
isClosed in interface AnonChannel

close

public void close()
Description copied from interface: AnonChannel
Closes the channel and releases all resources used.

Specified by:
close in interface AnonChannel

close_impl

protected abstract void close_impl()

recv

protected void recv(byte[] buff,
                    int pos,
                    int len)
             throws java.io.IOException
Throws:
java.io.IOException

send

protected abstract void send(byte[] buff,
                             int len)
                      throws java.io.IOException
Throws:
java.io.IOException

closedByPeer

public void closedByPeer()