|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.rosuda.JRclient.Rconnection
public class Rconnection
class providing TCP/IP connection to an Rserve
Field Summary | |
---|---|
static int |
AT_crypt
authorization type: unix crypt |
static int |
AT_plain
authorization type: plain text |
protected int |
rsrvVersion
version of the server (as reported in IDstring just after Rsrv) |
static java.lang.String |
transferCharset
This static variable specifies the character set used to encode string for transfer. |
Constructor Summary | |
---|---|
Rconnection()
make a new local connection on default port (6311) |
|
Rconnection(java.lang.String host)
make a new connection to specified host on default port (6311) |
|
Rconnection(java.lang.String host,
int port)
make a new connection to specified host and given port. |
Method Summary | |
---|---|
void |
assign(java.lang.String sym,
double[] val)
assign values of an array of doubles to a symbol in R (creating as vector of numbers). |
void |
assign(java.lang.String sym,
int[] val)
assign values of an array of integers to a symbol in R (creating as vector of numbers). |
void |
assign(java.lang.String sym,
REXP r)
assign a content of a REXP to a symbol in R. |
void |
assign(java.lang.String sym,
java.lang.String ct)
assign a string value to a symbol in R. |
void |
close()
closes current connection |
RFileOutputStream |
createFile(java.lang.String fn)
create a file on the Rserve for writing |
RSession |
detach()
detaches the session and closes the connection (requires Rserve 0.4+). |
REXP |
eval(java.lang.String cmd)
evaluates the given command and retrieves the result |
void |
finalize()
|
java.lang.String |
getLastError()
get last error string |
int |
getServerVersion()
get server version as reported during the handshake. |
boolean |
isConnected()
check connection state. |
void |
login(java.lang.String user,
java.lang.String pwd)
login using supplied user/pwd. |
boolean |
needLogin()
check authentication requirement sent by server |
RFileInputStream |
openFile(java.lang.String fn)
open a file on the Rserve for reading |
void |
removeFile(java.lang.String fn)
remove a file on the Rserve |
void |
setSendBufferSize(long sbs)
Sets send buffer size of the Rserve (in bytes) for the current connection. |
void |
shutdown()
shutdown remote Rserv. |
void |
voidEval(java.lang.String cmd)
evaluates the given command, but does not fetch the result (useful for assignment operations) |
RSession |
voidEvalDetach(java.lang.String cmd)
evaluates the given command, detaches the session (see @link{detach()}) and closes connection while the command is being evaluted (requires Rserve 0.4+). |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String transferCharset
public static final int AT_plain
public static final int AT_crypt
protected int rsrvVersion
Constructor Detail |
---|
public Rconnection() throws RSrvException
RSrvException
public Rconnection(java.lang.String host) throws RSrvException
host
- host name/IP
RSrvException
public Rconnection(java.lang.String host, int port) throws RSrvException
isConnected()
and/or #isOk
.
host
- host name/IPport
- TCP port
RSrvException
Method Detail |
---|
public void finalize()
finalize
in class java.lang.Object
public int getServerVersion()
public void close()
public void voidEval(java.lang.String cmd) throws RSrvException
cmd
- command/expression string
RSrvException
public RSession voidEvalDetach(java.lang.String cmd) throws RSrvException
cmd
- command/expression string
RSrvException
public REXP eval(java.lang.String cmd) throws RSrvException
cmd
- command/expression string
null
if an error occured
RSrvException
public void assign(java.lang.String sym, java.lang.String ct) throws RSrvException
sym
- symbol name. Currently assign uses CMD_setSEXP command of Rserve, i.e. the symbol value is NOT parsed. It is the responsibility of the user to make sure that the symbol name is valid in R (recall the difference between a symbol and an expression!). In fact R will always create the symbol, but it may not be accessible (examples: "bar\nfoo" or "bar$foo").ct
- contents
RSrvException
public void assign(java.lang.String sym, REXP r) throws RSrvException
sym
- symbol name. Currently assign uses CMD_setSEXP command of Rserve, i.e. the symbol value is NOT parsed. It is the responsibility of the user to make sure that the symbol name is valid in R (recall the difference between a symbol and an expression!). In fact R will always create the symbol, but it may not be accessible (examples: "bar\nfoo" or "bar$foo").ct
- contents. currently only basic types (int, double, int[], double[]) are supported.
RSrvException
public void assign(java.lang.String sym, double[] val) throws RSrvException
assign(String, REXP)
RSrvException
public void assign(java.lang.String sym, int[] val) throws RSrvException
assign(String, REXP)
RSrvException
public RFileInputStream openFile(java.lang.String fn) throws java.io.IOException
fn
- file name. should not contain any path delimiters, since Rserve may restrict the access to local working directory.
java.io.IOException
public RFileOutputStream createFile(java.lang.String fn) throws java.io.IOException
fn
- file name. should not contain any path delimiters, since Rserve may restrict the access to local working directory.
java.io.IOException
public void removeFile(java.lang.String fn) throws RSrvException
fn
- file name. should not contain any path delimiters, since Rserve may restrict the access to local working directory.
RSrvException
public void shutdown() throws RSrvException
RSrvException
public void setSendBufferSize(long sbs) throws RSrvException
sbs
- send buffer size (in bytes) min=32k, max=1GB
RSrvException
public void login(java.lang.String user, java.lang.String pwd) throws RSrvException
user
- usernamepwd
- password
RSrvException
public RSession detach() throws RSrvException
RSrvException
public boolean isConnected()
true
if this connection is alivepublic boolean needLogin()
true
is server requires authentication. In such case first
command after connecting must be login(java.lang.String, java.lang.String)
.public java.lang.String getLastError()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |