|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.rosuda.REngine.Rserve.protocol.RTalk
public class RTalk
This class encapsulates the QAP1 protocol used by Rserv. it is independent of the underying protocol(s), therefore RTalk can be used over any transport layer
The current implementation supports long (0.3+/0102) data format only up to 32-bit and only for incoming packets.
Field Summary | |
---|---|
static int |
CMD_assignSEXP
|
static int |
CMD_attachSession
|
static int |
CMD_closeFile
|
static int |
CMD_createFile
|
static int |
CMD_ctrlEval
|
static int |
CMD_ctrlShutdown
|
static int |
CMD_ctrlSource
|
static int |
CMD_detachedVoidEval
|
static int |
CMD_detachSession
|
static int |
CMD_eval
|
static int |
CMD_login
|
static int |
CMD_openFile
|
static int |
CMD_readFile
|
static int |
CMD_removeFile
|
static int |
CMD_setBufferSize
|
static int |
CMD_setEncoding
|
static int |
CMD_setSEXP
|
static int |
CMD_shutdown
|
static int |
CMD_voidEval
|
static int |
CMD_writeFile
|
static int |
DT_ARRAY
|
static int |
DT_BYTESTREAM
|
static int |
DT_CHAR
|
static int |
DT_DOUBLE
|
static int |
DT_INT
|
static int |
DT_LARGE
this is a flag saying that the contents is large (>0xfffff0) and hence uses 56-bit length field |
static int |
DT_SEXP
|
static int |
DT_STRING
|
static int |
ERR_access_denied
|
static int |
ERR_auth_failed
|
static int |
ERR_conn_broken
|
static int |
ERR_ctrl_closed
|
static int |
ERR_data_overflow
|
static int |
ERR_detach_failed
|
static int |
ERR_inv_cmd
|
static int |
ERR_inv_par
|
static int |
ERR_IOerror
|
static int |
ERR_not_open
|
static int |
ERR_object_too_big
|
static int |
ERR_out_of_mem
|
static int |
ERR_Rerror
|
static int |
ERR_session_busy
|
static int |
ERR_unknown_cmd
|
static int |
ERR_unsupported_cmd
|
Constructor Summary | |
---|---|
RTalk(java.io.InputStream sis,
java.io.OutputStream sos)
constructor; parameters specify the streams |
Method Summary | |
---|---|
static int |
getInt(byte[] buf,
int o)
converts bit-wise stored int in Intel-endian form into Java int |
static int |
getLen(byte[] buf,
int o)
converts bit-wise stored length from a header. |
static long |
getLong(byte[] buf,
int o)
converts bit-wise Intel-endian format into long |
static byte[] |
newHdr(int ty,
int len)
creates a new header according to the type and length of the parameter |
RPacket |
request(int cmd)
sends a request with no attached parameters |
RPacket |
request(int cmd,
byte[] cont)
sends a request with attached parameters |
RPacket |
request(int cmd,
byte[] prefix,
byte[] cont,
int offset,
int len)
sends a request with attached prefix and parameters. |
RPacket |
request(int cmd,
int par)
sends a request with one string parameter attached |
RPacket |
request(int cmd,
java.lang.String par)
sends a request with one string parameter attached |
static int |
setHdr(int ty,
int len,
byte[] buf,
int o)
writes cmd/resp/type byte + 3/7 bytes len into a byte buffer at specified offset. |
static void |
setInt(int v,
byte[] buf,
int o)
writes bit-wise int to a byte buffer at specified position in Intel-endian form |
static void |
setLong(long l,
byte[] buf,
int o)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DT_INT
public static final int DT_CHAR
public static final int DT_DOUBLE
public static final int DT_STRING
public static final int DT_BYTESTREAM
public static final int DT_SEXP
public static final int DT_ARRAY
public static final int DT_LARGE
public static final int CMD_login
public static final int CMD_voidEval
public static final int CMD_eval
public static final int CMD_shutdown
public static final int CMD_openFile
public static final int CMD_createFile
public static final int CMD_closeFile
public static final int CMD_readFile
public static final int CMD_writeFile
public static final int CMD_removeFile
public static final int CMD_setSEXP
public static final int CMD_assignSEXP
public static final int CMD_setBufferSize
public static final int CMD_setEncoding
public static final int CMD_detachSession
public static final int CMD_detachedVoidEval
public static final int CMD_attachSession
public static final int CMD_ctrlEval
public static final int CMD_ctrlSource
public static final int CMD_ctrlShutdown
public static final int ERR_auth_failed
public static final int ERR_conn_broken
public static final int ERR_inv_cmd
public static final int ERR_inv_par
public static final int ERR_Rerror
public static final int ERR_IOerror
public static final int ERR_not_open
public static final int ERR_access_denied
public static final int ERR_unsupported_cmd
public static final int ERR_unknown_cmd
public static final int ERR_data_overflow
public static final int ERR_object_too_big
public static final int ERR_out_of_mem
public static final int ERR_ctrl_closed
public static final int ERR_session_busy
public static final int ERR_detach_failed
Constructor Detail |
---|
public RTalk(java.io.InputStream sis, java.io.OutputStream sos)
sis
- socket input streamsos
- socket output streamMethod Detail |
---|
public static void setInt(int v, byte[] buf, int o)
v
- value to be writtenbuf
- buffero
- offset in the buffer to start at. An int takes always 4 bytespublic static int setHdr(int ty, int len, byte[] buf, int o)
ty
- type/cmd/resp bytelen
- lengthbuf
- buffero
- offset
public static byte[] newHdr(int ty, int len)
ty
- type/cmd/resp bytelen
- lengthpublic static int getInt(byte[] buf, int o)
buf
- buffer containg the representationo
- offset where to start (4 bytes will be used)
public static int getLen(byte[] buf, int o)
buf
- buffero
- offset of the header (length is at o+1)
public static long getLong(byte[] buf, int o)
buf
- buffero
- offset (8 bytes will be used)
public static void setLong(long l, byte[] buf, int o)
public RPacket request(int cmd)
cmd
- command
null
if something went wrongpublic RPacket request(int cmd, byte[] cont)
cmd
- commandcont
- contents - parameters
null
if something went wrongpublic RPacket request(int cmd, byte[] prefix, byte[] cont, int offset, int len)
null
. Effectively request(a,b,null)
and request(a,null,b)
are equivalent.
cmd
- command - a special command of -1 prevents request from sending anythingprefix
- - this content is sent *before* cont. It is provided to save memory copy operations where a small header precedes a large data chunk (usually prefix conatins the parameter header and cont contains the actual data).cont
- contentsoffset
- offset in cont where to start sending (if <0 then 0 is assumed, if >cont.length then no cont is sent)len
- number of bytes in cont to send (it is clipped to the length of cont if necessary)
null
if something went wrongpublic RPacket request(int cmd, java.lang.String par)
cmd
- commandpar
- parameter - length and DT_STRING will be prepended
null
if something went wrongpublic RPacket request(int cmd, int par)
cmd
- commandpar
- parameter of the type DT_INT
null
if something went wrong
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |