Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.vrspace.server
Class BinarySession  view BinarySession download BinarySession.java

java.lang.Object
  extended byjava.util.Observable
      extended byorg.vrspace.server.Session
          extended byorg.vrspace.server.BinarySession
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
GZipSession

public class BinarySession
extends Session

A session able to send and read raw bytes.


Nested Class Summary
 
Nested classes inherited from class org.vrspace.server.Session
Session.Status
 
Field Summary
protected  byte[] buffer
           
protected  org.vrspace.attributes.Filter filter
           
protected  java.io.InputStream in
           
protected  java.io.OutputStream out
           
protected  java.io.OutputStream output
           
protected  long receivedBytes
           
protected  long sentBytes
           
 
Fields inherited from class org.vrspace.server.Session
active, cacheRequests, client, daemon, dispatcher, lastTime, lf, receivedChars, receivedRequests, RESPONSE_ERR, RESPONSE_NONE, RESPONSE_OK, sentChars, sentRequests, server, socket, startTime, stopTime, TERMINATOR, writer
 
Fields inherited from class java.util.Observable
 
Constructor Summary
BinarySession()
           
BinarySession(Server server, java.net.Socket s, Dispatcher d, java.io.OutputStream out)
          Creates new Session which will write bytes to out
BinarySession(Server server, java.net.Socket s, Dispatcher d, java.io.OutputStream out, org.vrspace.attributes.Filter filter)
          Creates new Session which will write bytes to out after filtering them with filter
 
Method Summary
 void close()
          End session.
protected  void readln()
          Reads bytes from the socket and writes them to the OutputStream.
protected  void write(byte[] b)
          Send b to the client.
protected  void write(byte[] b, int offset, int len)
          Send subset of b to the client.
 
Methods inherited from class org.vrspace.server.Session
flushRequests, getId, getStatus, isActive, read, run, sendError, sendRequest, sendResponse, write
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buffer

protected byte[] buffer

output

protected java.io.OutputStream output

in

protected java.io.InputStream in

out

protected java.io.OutputStream out

filter

protected org.vrspace.attributes.Filter filter

sentBytes

protected long sentBytes

receivedBytes

protected long receivedBytes
Constructor Detail

BinarySession

public BinarySession()

BinarySession

public BinarySession(Server server,
                     java.net.Socket s,
                     Dispatcher d,
                     java.io.OutputStream out)
              throws java.lang.Exception
Creates new Session which will write bytes to out


BinarySession

public BinarySession(Server server,
                     java.net.Socket s,
                     Dispatcher d,
                     java.io.OutputStream out,
                     org.vrspace.attributes.Filter filter)
              throws java.lang.Exception
Creates new Session which will write bytes to out after filtering them with filter

Method Detail

readln

protected void readln()
Reads bytes from the socket and writes them to the OutputStream. If Filter exists, bytes are filtered using Filter.filter( byte[] ) and then written to the OutputStream.

Overrides:
readln in class Session

write

protected void write(byte[] b)
              throws java.io.IOException
Send b to the client.


write

protected void write(byte[] b,
                     int offset,
                     int len)
              throws java.io.IOException
Send subset of b to the client.


close

public void close()
End session.

Overrides:
close in class Session