net.alhem.jsockets
Class TcpSocket

java.lang.Object
  extended by net.alhem.jsockets.Socket
      extended by net.alhem.jsockets.TcpSocket
Direct Known Subclasses:
HTTPSocket

public class TcpSocket
extends Socket

Buffered socket i/o

Author:
Anders Hedstrom (grymse@alhem.net)

Field Summary
protected  java.nio.ByteBuffer m_ibuf
           
private  int m_ilen
           
protected  java.lang.StringBuffer m_line
           
protected  java.nio.ByteBuffer m_obuf
           
private  int m_olen
           
 
Constructor Summary
TcpSocket(SocketHandler h)
           
TcpSocket(SocketHandler h, int ilen, int olen)
          Creates a new instance of TcpSocket
 
Method Summary
 Socket Create()
           
 void OnDelete()
           
 void OnInitialOps()
           
 void OnRead()
           
 void OnWrite()
           
 void Open(java.lang.String host, int port)
           
 void ReadLine()
           
 void Send(java.lang.String str)
           
 void SendBuf(byte[] bbuf, int l)
           
 
Methods inherited from class net.alhem.jsockets.Socket
attach, CloseAndDelete, Connecting, GetChannel, GetKey, Handler, LineProtocol, OnAccept, OnConnect, OnLine, OnRawData, SetCloseAndDelete, SetConnecting, SetConnecting, SetKey, SetLineProtocol, SetLineProtocol, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_ilen

private int m_ilen

m_olen

private int m_olen

m_ibuf

protected java.nio.ByteBuffer m_ibuf

m_obuf

protected java.nio.ByteBuffer m_obuf

m_line

protected java.lang.StringBuffer m_line
Constructor Detail

TcpSocket

public TcpSocket(SocketHandler h,
                 int ilen,
                 int olen)
Creates a new instance of TcpSocket


TcpSocket

public TcpSocket(SocketHandler h)
Method Detail

Create

public Socket Create()
Specified by:
Create in class Socket

OnInitialOps

public void OnInitialOps()
Specified by:
OnInitialOps in class Socket

Open

public void Open(java.lang.String host,
                 int port)

OnRead

public void OnRead()
Overrides:
OnRead in class Socket

OnDelete

public void OnDelete()
Overrides:
OnDelete in class Socket

ReadLine

public void ReadLine()
Overrides:
ReadLine in class Socket

Send

public void Send(java.lang.String str)

SendBuf

public void SendBuf(byte[] bbuf,
                    int l)

OnWrite

public void OnWrite()
Overrides:
OnWrite in class Socket