Interface ServerStream

All Superinterfaces:
AutoCloseable, Closeable, de.aristaflow.adept2.model.communication.ServerSideProxy, de.aristaflow.adept2.model.communication.TimeTrackingSsProxy
All Known Implementing Classes:
ServerInputStream, ServerUDTInputStream

public interface ServerStream extends de.aristaflow.adept2.model.communication.TimeTrackingSsProxy
A server stream establishes a connection between a client and a server and allows the client to access the stream via the AristaFlow-communication framework. Therefore the content of an input stream does not need to be transferred completely from server to client but will be transferred as requested.

This behaviour is achieved by using the normal proxy/callback mechanisms of the communication framework, that is, when requesting a ServerStream a proxy is created at the client and this connects to the originating stream on the server. The connection remains open until closing the stream or shutting down the communication.
When transferring a ServerStream as parameter to the server, the client will export it, transfer the URI and the server will create a proxy for the URI/the stream. Note that if the client terminates before the server closes the stream, the server will not be able to access the stream any longer since the stream is disconnected. To prevent this behaviour and memory leaks, the server has to close() the stream eventually.
Unlike a normal input stream, a disconnected ServerStream throws ServiceConnectionExceptions for every called method instead of the usual IOException.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface de.aristaflow.adept2.model.communication.ServerSideProxy

    de.aristaflow.adept2.model.communication.ServerSideProxy.LegacySspCloser, de.aristaflow.adept2.model.communication.ServerSideProxy.ServerSideProxyRemover
  • Field Summary

    Fields inherited from interface de.aristaflow.adept2.model.communication.ServerSideProxy

    DEFAULT_ALIVE_TIME

    Fields inherited from interface de.aristaflow.adept2.model.communication.TimeTrackingSsProxy

    DEFAULT_CLOSE_DEFER_TIME, MAX_ALIVE_TIME_EXTENSION
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    void
    InputStream.close() This additionally removes the skeleton in the communication framework.
    void
    mark(int readlimit)
    boolean
    int
    byte[]
    read(int len)
    Resembles InputStream.read(byte[]) by reading the designated amount of bytes from the stream.
    void
    long
    skip(long n)

    Methods inherited from interface de.aristaflow.adept2.model.communication.TimeTrackingSsProxy

    enter, exit, getCloseTime, getRemainingAliveTime, isBusy, keepAlive, setCloseTime
  • Method Details

    • read

      int read() throws IOException
      Throws:
      de.aristaflow.adept2.model.communication.ServiceConnectionException - If the underlying stream cannot be reached any more through the communication framework, a ServiceConnectionException will be thrown.
      IOException
    • read

      byte[] read(int len) throws IOException
      Resembles InputStream.read(byte[]) by reading the designated amount of bytes from the stream. If there are less bytes remaining in the stream, the returned byte array will be correspondingly shorter. If no bytes remain (java.io.InputStream#read(byte[]) returns -1), null will be returned.
      Throws:
      de.aristaflow.adept2.model.communication.ServiceConnectionException - If the underlying stream cannot be reached any more through the communication framework, a ServiceConnectionException will be thrown.
      IOException
    • skip

      long skip(long n) throws IOException
      Throws:
      de.aristaflow.adept2.model.communication.ServiceConnectionException - If the underlying stream cannot be reached any more through the communication framework, a ServiceConnectionException will be thrown.
      IOException
    • available

      int available() throws IOException
      Throws:
      de.aristaflow.adept2.model.communication.ServiceConnectionException - If the underlying stream cannot be reached any more through the communication framework, a ServiceConnectionException will be thrown.
      IOException
    • close

      void close() throws IOException
      InputStream.close() This additionally removes the skeleton in the communication framework.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface de.aristaflow.adept2.model.communication.ServerSideProxy
      Throws:
      de.aristaflow.adept2.model.communication.ServiceConnectionException - If the underlying stream cannot be reached any more through the communication framework, a ServiceConnectionException will be thrown.
      IOException
    • mark

      void mark(int readlimit)
      Throws:
      de.aristaflow.adept2.model.communication.ServiceConnectionException - If the underlying stream cannot be reached any more through the communication framework, a ServiceConnectionException will be thrown.
    • reset

      void reset() throws IOException
      Throws:
      de.aristaflow.adept2.model.communication.ServiceConnectionException - If the underlying stream cannot be reached any more through the communication framework, a ServiceConnectionException will be thrown.
      IOException
    • markSupported

      boolean markSupported()
      Throws:
      de.aristaflow.adept2.model.communication.ServiceConnectionException - If the underlying stream cannot be reached any more through the communication framework, a ServiceConnectionException will be thrown.