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

## edu.emory.mathcs.util.remote.io
Class RemoteInputStream

    java.lang.Object
      java.io.InputStream
          edu.emory.mathcs.util.remote.io.RemoteInputStream

All Implemented Interfaces:
  java.io.Externalizable, java.io.Serializable

public class RemoteInputStream
extends java.io.InputStream
implements java.io.Externalizable

Serializable input stream that reads from an input stream on a remote host, using RMI (or RMIX, or Jini ERI, ...). Since RMI itself can be enabled over various protocols and socket factories, this class allows to tunnel byte streams through a variety of protocols. For example, if used with RMIX, it is possible to tunnel streams via SOAP/HTTP. Typical usage pattern is to create the instance at the server side and then send it to the client via RMI:

     InputStream getRemoteStream() throws RemoteException {
        InputStream source = ...;
        RemoteInputStreamSrv srv = new RemoteInputStreamSrvImpl(source);
        // the following line for standard RMI only (not RMIX or JERI)
        UnicastRemoteObject.exportObject(srv);
        return new RemoteInputStream(source);
     }

Version:
  1.0
Author:
  Dawid Kurzyniec
See Also:
  Serialized Form

Constructor Summary
`RemoteInputStream()` for deserialization only
`RemoteInputStream(java.io.InputStream in)` Deprecated. this constructor does not work correctly with standard Java RMI (it only works with RMIX). See this class javadoc for instantiation instructions.
`RemoteInputStream(RemoteInputStreamSrv server)` Constructs a new serializable remote input stream reading from the specified stream handle.

Method Summary
`int` | `available()`
`void` | `close()`
`int` | `read()`
`int` | `read(byte[] b, int off, int len)`
`void` | `readExternal(java.io.ObjectInput in)`
`long` | `skip(long n)`
`void` | `writeExternal(java.io.ObjectOutput out)`

Methods inherited from class java.io.InputStream
`mark, markSupported, read, reset`

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

Constructor Detail

### RemoteInputStream

    public RemoteInputStream()

  for deserialization only

### RemoteInputStream

    public RemoteInputStream(java.io.InputStream in)

  Deprecated. this constructor does not work correctly with standard Java RMI (it only works with RMIX). See this class javadoc for instantiation instructions.

  Constructs a new serializable remote input stream reading from the specified stream.

Parameters:
  `in` - the source stream

### RemoteInputStream

    public RemoteInputStream(RemoteInputStreamSrv server)

  Constructs a new serializable remote input stream reading from the specified stream handle. Use this constructor on the client side if the RMI handle to the server has been already created.

Parameters:
  `server` - RMI handle to the source stream

Method Detail

### read

    public int read()
             throws java.io.IOException

  Throws:
    `java.io.IOException`

### read

    public int read(byte[] b,
                    int off,
                    int len)
             throws java.io.IOException

  Throws:
    `java.io.IOException`

### skip

    public long skip(long n)
              throws java.io.IOException

  Throws:
    `java.io.IOException`

### available

    public int available()
                  throws java.io.IOException

  Throws:
    `java.io.IOException`

### close

    public void close()
               throws java.io.IOException

  Throws:
    `java.io.IOException`

### writeExternal

    public void writeExternal(java.io.ObjectOutput out)
                       throws java.io.IOException

  Specified by:
    `writeExternal` in interface `java.io.Externalizable`
  Throws:
    `java.io.IOException`

### readExternal

    public void readExternal(java.io.ObjectInput in)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException

  Specified by:
    `readExternal` in interface `java.io.Externalizable`
  Throws:
    `java.io.IOException`
    `java.lang.ClassNotFoundException`

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