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 untilclosing the stream
or shutting down the communication.
When transferring aServerStream
as parameter to the server, the client will be 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 toclose()
the stream eventually.
Unlike a normal input stream, a disconnectedServerStream
throwsServiceConnectionException
s for every called method instead of the usualIOException
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
available()
void
close()
InputStream.close()
This additionally removes the skeleton in the communication framework.void
mark(int readlimit)
boolean
markSupported()
int
read()
byte[]
read(int len)
ResemblesInputStream.read(byte[])
by reading the designated amount of bytes from the stream.void
reset()
long
skip(long n)
-
-
-
Method Detail
-
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, aServiceConnectionException
will be thrown.IOException
-
read
byte[] read(int len) throws IOException
ResemblesInputStream.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, aServiceConnectionException
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, aServiceConnectionException
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, aServiceConnectionException
will be thrown.IOException
-
close
void close() throws IOException
InputStream.close()
This additionally removes the skeleton in the communication framework.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfacede.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, aServiceConnectionException
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, aServiceConnectionException
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, aServiceConnectionException
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, aServiceConnectionException
will be thrown.
-
-