This is an input stream that actually pulls down the stream data from a remote server. Note that this extends
InputStream
so it can be used as any normal stream object; however, all methods are overridden to actually delegate the methods to the remote stream.
In order to be able to use this object, you should understand how input streams are remoted. First, an input stream must be {@link ServiceContainer#addRemoteInputStream(InputStream) assigned a server-side service component}. At that point, your server is ready to begin accepting remote commands to read the input stream. That's where this object comes in. You instantiate this object by giving its constructor the ID of the stream and the service container where that input stream was registered. Note that, for convienence, the constructor {@link RemoteInputStream#RemoteInputStream(InputStream,ServiceContainer)} is provided to both add the input streamto the server-side services container and instantiate this object with the appropriate stream ID. This {@link RemoteInputStream} object can then be passed to a remote client in some way (typically by serializing it aspart of a {@link Command}). The remote endpoint must then tell this object (after its been deserialized) which {@link #setClientCommandSender(ClientCommandSender) client sender} to use when communicating back to the server(which it needs to do when pulling the stream data). We need that remote endpoint to give this object a sender because its the remote endpoint's job to configure that sender with things like its keystore and truststore locations (when transporting over SSL). In order to configure that client sender, the remote endpoint must create the sender such that it uses the {@link #getServerEndpoint() server endpoint} as its target. After the remote endpoint sets upits sender in this object, it is free to operate on this object as if it were a "normal" InputStream
. Note that remote input streams should be {@link #close() closed} in order to clean up server-side resources in atimely manner.
@author John Mazzitelli