org.rosuda.REngine.Rserve
Class RFileOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.rosuda.REngine.Rserve.RFileOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class RFileOutputStream
extends java.io.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 2743 2007-05-04 16:42:17Z urbanek $

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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

write

public void write(int b)
           throws java.io.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).

Specified by:
write in class java.io.OutputStream
Parameters:
b - byte to write
Throws:
java.io.IOException

write

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

Overrides:
write in class java.io.OutputStream
Parameters:
b - content to write
Throws:
java.io.IOException

write

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

Overrides:
write in class java.io.OutputStream
Parameters:
b - buffer containing the bytes to write
off - offset where to start
len - number of bytes to write
Throws:
java.io.IOException

close

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

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream
Throws:
java.io.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.

Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream