All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jive.erlang.Unpacker

java.lang.Object
   |
   +----jive.erlang.Unpacker

public class Unpacker
extends Object
Unpacker is a class that parses messages sent from the Erlang side. The class transforms the messages into EVar objects depending of the type of variable.

Accepted variable types are: EString, EInteger, EFloat, EAtom, EList, ETuple, EProcess, EBinary

The Unpacker class will either parse an expression and return the EVar or it will parse a message consisting of a receiver and a message and then deliver the message to a given receiver.

Author:
Kaj Nygren (kaj@medialab.ericsson.se), Joakim Grebenö (jocke@erix.ericsson.se)

Variable Index

 o s

Constructor Index

 o Unpacker(InputStream, EReceiver)
Creates an Unpacker that parses messages from the Erlang side and deliver them to a receiver on the Java side.

Method Index

 o getAtom(boolean)
This method parses the input stream for an Erlang atom and returns an EAtom object containing the atom.
 o getBinary(boolean)
This method parses the input stream for an Erlang binary and returns a EBinary object containing the binary.
 o getError(boolean)
This method parses the input stream for an error message and throws a JiveException with a given message

If the tag parameter is true it will expect an EERROR tag first in the stream, otherwise it will assume that the stream contains a valid error message.

 o getFloat(boolean)
This method parses the input stream for an Erlang float and returns an EFloat object containing the float.
 o getInteger(boolean)
This method parses the input stream for an Erlang integer and returns an EInteger object containing the integer.
 o getList(boolean)
This method parses the input stream for an Erlang list and returns a EList object containing the list.
 o getPid(boolean)
This method parses the input stream for an Erlang pid and returns a EPid object containing the pid.
 o getPort(boolean)
This method parses the input stream for an Erlang port and returns a EPort object containing the port.
 o getProcess(boolean)
This method parses the input stream for an Erlang pid-id and returns a EProcess object containing the pid-id.
 o getReference(boolean)
This method parses the input stream for an Erlang reference and returns a EReference object containing the reference.
 o getString(boolean)
This method parses the input stream for an Erlang string and returns an EString object containing the string.
 o getTuple(boolean)
This method parses the input stream for an Erlang tuple and returns a ETuple object containing the tuple.
 o parseExpression()
This method parses an expression from the input stream and returns the expression as an EVar object.
 o parseMessage()
Parses a message sent from the Erlang server to a client.
 o parseReply()
Parses a reply sent from the Erlang server to a client.

Variables

 o s
 public Socket s

Constructors

 o Unpacker
 public Unpacker(InputStream input,
                 EReceiver receiver)
Creates an Unpacker that parses messages from the Erlang side and deliver them to a receiver on the Java side.

Methods

 o getString
 public synchronized EString getString(boolean tag) throws JiveException
This method parses the input stream for an Erlang string and returns an EString object containing the string.

If the tag parameter is true it will expect an ESTRING tag first in the stream, otherwise it will assume that the stream contains a valid string.

Throws: JiveException
if a connection or parsing error occurred.
 o getAtom
 public synchronized EAtom getAtom(boolean tag) throws JiveException
This method parses the input stream for an Erlang atom and returns an EAtom object containing the atom.

If the tag parameter is true it will expect an EATOM tag first in the stream, otherwise it will assume that the stream contains a valid atom.

Throws: JiveException
if a connection or parsing error occurred.
 o getFloat
 public synchronized EFloat getFloat(boolean tag) throws JiveException
This method parses the input stream for an Erlang float and returns an EFloat object containing the float.

If the tag parameter is true it will expect an EFLOAT tag first in the stream, otherwise it will assume that the stream contains a valid float.

Throws: JiveException
if a connection or parsing error occurred.
 o getInteger
 public synchronized EInteger getInteger(boolean tag) throws JiveException
This method parses the input stream for an Erlang integer and returns an EInteger object containing the integer.

If the tag parameter is true it will expect an EINTEGER tag first in the stream, otherwise it will assume that the stream contains a valid integer.

Throws: JiveException
if a connection or parsing error occurred.
 o getProcess
 public synchronized EProcess getProcess(boolean tag) throws JiveException
This method parses the input stream for an Erlang pid-id and returns a EProcess object containing the pid-id.

The pid-id is NOT the same as an Erlang pid. Instead it is an id-value used internally by the jive Erlang server.

If the tag parameter is true it will expect an EPROCESS tag first in the stream, otherwise it will assume that the stream contains a valid pid-id.

Throws: JiveException
if a connection or parsing error occurred.
 o getTuple
 public synchronized ETuple getTuple(boolean tag) throws JiveException
This method parses the input stream for an Erlang tuple and returns a ETuple object containing the tuple.

If the tag parameter is true it will expect an ETUPLE tag first in the stream, otherwise it will assume that the stream contains a valid tuple.

Throws: JiveException
if a connection or parsing error occurred.
 o getList
 public synchronized EList getList(boolean tag) throws JiveException
This method parses the input stream for an Erlang list and returns a EList object containing the list.

If the tag parameter is true it will expect an ELIST tag first in the stream, otherwise it will assume that the stream contains a valid list.

Throws: JiveException
if a connection or parsing error occurred.
 o getBinary
 public synchronized EBinary getBinary(boolean tag) throws JiveException
This method parses the input stream for an Erlang binary and returns a EBinary object containing the binary.

If the tag parameter is true it will expect an ELIST tag first in the stream, otherwise it will assume that the stream contains a valid list.

Throws: JiveException
if a connection or parsing error occurred.
 o getReference
 public synchronized EReference getReference(boolean tag) throws JiveException
This method parses the input stream for an Erlang reference and returns a EReference object containing the reference.

If the tag parameter is true it will expect an ELIST tag first in the stream, otherwise it will assume that the stream contains a valid list.

Throws: JiveException
if a connection or parsing error occurred.
 o getPort
 public synchronized EPort getPort(boolean tag) throws JiveException
This method parses the input stream for an Erlang port and returns a EPort object containing the port.

If the tag parameter is true it will expect an ELIST tag first in the stream, otherwise it will assume that the stream contains a valid list.

Throws: JiveException
if a connection or parsing error occurred.
 o getPid
 public synchronized EPid getPid(boolean tag) throws JiveException
This method parses the input stream for an Erlang pid and returns a EPid object containing the pid.

If the tag parameter is true it will expect an ELIST tag first in the stream, otherwise it will assume that the stream contains a valid list.

Throws: JiveException
if a connection or parsing error occurred.
 o getError
 public synchronized void getError(boolean tag) throws JiveSecurityException, JiveIOException, JiveException
This method parses the input stream for an error message and throws a JiveException with a given message

If the tag parameter is true it will expect an EERROR tag first in the stream, otherwise it will assume that the stream contains a valid error message.

Throws: JiveSecurityException
is thrown if a security violation occurred.
Throws: JiveIOException
is thrown if a communication error occurred.
Throws: JiveException
is thrown with an error text given by the server.
 o parseExpression
 public synchronized EVar parseExpression() throws JiveSecurityException, JiveIOException, JiveException
This method parses an expression from the input stream and returns the expression as an EVar object.

Throws: JiveSecurityException
is thrown if a security violation occurred.
Throws: JiveIOException
is thrown if a communication error occurred.
Throws: JiveException
is thrown with an error text given by the server.
 o parseMessage
 public synchronized void parseMessage() throws JiveSecurityException, JiveIOException, JiveException
Parses a message sent from the Erlang server to a client. First the receiver of the message is read from the input stream, then the Erlang expression is read and converted to an EVar object. Finally the EVar object is delivered to the recipient.

Throws: JiveSecurityException
is thrown if a security violation occurred.
Throws: JiveIOException
is thrown if a communication error occurred.
Throws: JiveException
is thrown with an error text given by the server.
 o parseReply
 public synchronized EVar parseReply() throws JiveSecurityException, JiveIOException, JiveException
Parses a reply sent from the Erlang server to a client. The reply is either an Erlang variable, which is returned as an EVar, or an error message which causes a JiveException to be thrown.

Throws: JiveSecurityException
is thrown if a security violation occurred.
Throws: JiveIOException
is thrown if a communication error occurred.
Throws: JiveException
is thrown with an error text given by the server.

All Packages  Class Hierarchy  This Package  Previous  Next  Index