Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.jstacs.utils
Class RUtils

    java.lang.Object
      de.jstacs.utils.RUtils

    public class RUtils

extends Object

This is a collection of various silly things you can do when accessing Rserve.
This class is based on an implementation of Andreas Stephanik and further developed by Jens Keilwagen.

Author:
  Andreas Stephanik, Jens Keilwagen

Constructor Summary
`RUtils()`

Method Summary
`static int` | `copyFileFromServer(String sourcePath, String targetPath, RConnection c)` This method copies a file from the server to the client.
`static void` | `copyFileToServer(File source, String targetName, RConnection rconnection)` Copies a file to the R side.
`static void` | `copyFileToServer(String sourcePath, String targetName, RConnection rconnection)` Copies a file to the R side.
`protected static byte[]` | `getBytesFromFileOnServer(String sourcePath, RConnection c)` This method returns the content of a file on the server as byte array.
`static void` | `installRScript(String sourcePath, String targetName, RConnection rconnection)` Installs an R script on the Rserve server Do not forget to remove the R script by RConnection.removeFile(targetName) at the end of your session.
`static RConnection` | `openRConnection(String rServeHostName, String loginName, String passwd)` This method opens an RConnection

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RUtils

    public RUtils()

Method Detail

### installRScript

    public static void installRScript(String sourcePath,
                                      String targetName,
                                      RConnection rconnection)
                               throws Exception

  Installs an R script on the Rserve server Do not forget to remove the R script by RConnection.removeFile(targetName) at the end of your session.

  Parameters:
    `sourcePath` - Path of your R script on your local box. This script will be copied to the Rserve server (e.g. pdw-24 /tmp/Rserve/conn*)
    `targetName` - Just the desired name of the R script on the Rserve server (mostly the same as on local box, but without path delimeters!). Should not contain any path delimiters, since Rserve may restrict the access to local working directory.
    `rconnection` - An already open connection to the Rserve server.
  Throws:
    `Exception`

### copyFileToServer

    public static void copyFileToServer(File source,
                                        String targetName,
                                        RConnection rconnection)
                                 throws Exception

  Copies a file to the R side. Normally it is send to /tmp/Rserve/conn*

  Parameters:
    `source` - the source file
    `targetName` - Should not contain any path delimiters, since Rserve may restrict the access to local working directory.
    `rconnection` - the connection to R
  Throws:
    `Exception` - if something went wrong while copying

### copyFileToServer

    public static void copyFileToServer(String sourcePath,
                                        String targetName,
                                        RConnection rconnection)
                                 throws Exception

  Copies a file to the R side. Normally it is send to /tmp/Rserve/conn*

  Parameters:
    `sourcePath` - the source path
    `targetName` - Should not contain any path delimiters, since Rserve may restrict the access to local working directory.
    `rconnection` - the connection to R
  Throws:
    `Exception` - if something went wrong while copying
  See Also:
    `copyFileToServer(File, String, RConnection)`

### copyFileFromServer

    public static int copyFileFromServer(String sourcePath,
                                         String targetPath,
                                         RConnection c)
                                  throws Exception

  This method copies a file from the server to the client.

  Parameters:
    `sourcePath` - the server path name
    `targetPath` - the client path name
    `c` - the connection to R
  Returns:
    the number of copied bytes
  Throws:
    `Exception` - if the file could not be copied
  See Also:
    `getBytesFromFileOnServer(String, RConnection)`

### getBytesFromFileOnServer

    protected static byte[] getBytesFromFileOnServer(String sourcePath,
                                                     RConnection c)
                                              throws Exception

  This method returns the content of a file on the server as byte array.

  Parameters:
    `sourcePath` - the the sourcePath name
    `c` - the connection to R
  Returns:
    a byte array with the content of `sourcePath`
  Throws:
    `Exception` - if the content of the source could not be copied in the byte array

### openRConnection

    public static RConnection openRConnection(String rServeHostName,
                                              String loginName,
                                              String passwd)
                                       throws Exception

  This method opens an RConnection

  Parameters:
    `rServeHostName` - the name of the server with RServe
    `loginName` - the login (if needed)
    `passwd` - the password (if needed)
  Returns:
    a connection to R
  Throws:
    `Exception` - if no connection could be established

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD