org.rosuda.JRclient
Class RFileOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byorg.rosuda.JRclient.RFileOutputStream

public class RFileOutputStream
extends OutputStream

RFileOutputStream is an OutputStream to transfer files from the client to Rserve server. It is used very much like a FileOutputStream. Currently mark and seek is not supported. The current implementation is also "one-shot" only, that means the file can be written only once.

Version:
$Id: RFileOutputStream.java,v 1.1 2005/10/05 20:20:16 eytanadar Exp $

Method Summary
 void close()
          close stream - is not related to the actual Rconnection, calling close does not close the Rconnection.
 void flush()
          currently (Rserve 0.3) there is no way to force flush on the remote side, hence this function is noop.
 void write(byte[] b)
          writes the content of b into the file.
 void write(byte[] b, int off, int len)
          Writes specified number of bytes to the remote file.
 void write(int b)
          writes one byte to the file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

write

public void write(int b)
           throws IOException
writes one byte to the file. This function should be avoided, since RFileOutputStream provides no buffering. This means that each call to this function leads to a complete packet exchange between the server and the client. Use write(byte[]) instead whenever possible. In fact this function calls write(b,0,1).

Parameters:
b - byte to write
Throws:
IOException

write

public void write(byte[] b)
           throws IOException
writes the content of b into the file. This methods is equivalent to calling write(b,0,b.length).

Parameters:
b - content to write
Throws:
IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Writes specified number of bytes to the remote file.

Parameters:
b - buffer containing the bytes to write
off - offset where to start
len - number of bytes to write
Throws:
IOException

close

public void close()
           throws IOException
close stream - is not related to the actual Rconnection, calling close does not close the Rconnection.

Throws:
IOException

flush

public void flush()
currently (Rserve 0.3) there is no way to force flush on the remote side, hence this function is noop. Future versions of Rserve may support this feature though. At any rate, it is safe to call it.