|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--de.bb.bejy.Protocol
base class for all protocols used in BEJY.
provides some usefull functions to handle incoming data
| Field Summary | |
protected Factory |
factory
reference to this protocol's factory |
protected java.io.InputStream |
is
the input stream to read from |
protected java.io.OutputStream |
os
the output stream to write to |
protected java.lang.String |
remoteAddress
address ot the other side |
protected de.bb.bejy.Server |
server
reference to this protocol's server (thread) |
| Constructor Summary | |
protected |
Protocol(Factory f)
the only constructor |
| Method Summary | |
protected abstract boolean |
doit()
contains the protocol main loop. |
protected boolean |
goodStream()
checks whether current streams are still usable |
protected ByteRef |
readFirst()
read the first available bytes into a ByteArray object |
protected ByteRef |
readLine(ByteRef br)
read the next line into a ByteArray using a 2nd ByteArray as buffer. If there is no complete line in the provided buffer, the next chunk of data is read from the input stream. |
protected void |
trigger()
a callback function which is called before the server starts to listen for incoming data. Necessary when the server must send data before the clients starts sending. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.io.OutputStream os
protected java.io.InputStream is
protected Factory factory
protected de.bb.bejy.Server server
protected java.lang.String remoteAddress
| Constructor Detail |
protected Protocol(Factory f)
f - the Factory object which creates this object| Method Detail |
protected abstract boolean doit()
throws java.lang.Exception
in both cases the server object and the protocol object is reused
java.lang.Exception - indicates that even the server object must be discardedjava.lang.Exception - protected boolean goodStream()
protected void trigger()
throws java.lang.Exception
java.lang.Exception - protected ByteRef readFirst()
protected ByteRef readLine(ByteRef br)
br - the read buffer which contains already read data
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||