com.twistedmatrix.spread
Class Banana

java.lang.Object
  |
  +--com.twistedmatrix.spread.Banana
Direct Known Subclasses:
Broker

public class Banana
extends java.lang.Object

The Banana wire protocol - an efficient, asynchronous byte-encoding for s-expressions.


Inner Class Summary
static class Banana.ProtocolException
          An error occured in the protocol.
 
Field Summary
protected static ByteString[] DIALECTS
           
protected  boolean disconnected
           
protected static int FLOAT
           
protected static int HIGH_BIT_SET
           
protected  BananaDecoder in
           
protected static int INT
           
protected static int LIST
           
protected static int LONGINT
           
protected static int LONGNEG
           
protected static int NEG
           
protected static ByteString NONE
           
protected  BananaEncoder out
           
protected static ByteString PB
           
protected static int STRING
           
protected static int VOCAB
           
protected static java.util.ArrayList vocabulary
           
 
Constructor Summary
Banana(StreamPair sp, boolean isClient)
          Create a new instance given a pair of streams.
 
Method Summary
 void close()
          Close the connection.
static void handshake(Banana client, Banana server)
          Do handshake between two instances.
 java.lang.Object read()
          Read from connection.
 void start()
          Do profile handshake and start reader thread.
 void write(java.lang.Object o)
          Write to connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PB

protected static final ByteString PB

NONE

protected static final ByteString NONE

DIALECTS

protected static final ByteString[] DIALECTS

HIGH_BIT_SET

protected static final int HIGH_BIT_SET

LIST

protected static final int LIST

INT

protected static final int INT

STRING

protected static final int STRING

NEG

protected static final int NEG

FLOAT

protected static final int FLOAT

LONGINT

protected static final int LONGINT

LONGNEG

protected static final int LONGNEG

VOCAB

protected static final int VOCAB

vocabulary

protected static java.util.ArrayList vocabulary

in

protected BananaDecoder in

out

protected BananaEncoder out

disconnected

protected boolean disconnected
Constructor Detail

Banana

public Banana(StreamPair sp,
              boolean isClient)
Create a new instance given a pair of streams.
Method Detail

start

public void start()
Do profile handshake and start reader thread.

close

public void close()
Close the connection.

write

public void write(java.lang.Object o)
           throws java.io.IOException
Write to connection.

read

public java.lang.Object read()
                      throws java.io.IOException,
                             Banana.ProtocolException
Read from connection.

handshake

public static void handshake(Banana client,
                             Banana server)
                      throws java.io.IOException
Do handshake between two instances. Useful for testing.