Class ServerInputStream
java.lang.Object
de.aristaflow.adept2.model.common.communication.ServerInputStream
- All Implemented Interfaces:
ServerStream,de.aristaflow.adept2.model.communication.ServerSideProxy,de.aristaflow.adept2.model.communication.TimeTrackingSsProxy,Closeable,AutoCloseable
- Direct Known Subclasses:
ServerUDTInputStream
This is a simple wrapper for an
InputStream as
ServerStream which allows for keeping an
InputStream locally and use it remotely.-
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
FieldsModifier and TypeFieldDescriptionprotected final longThe time in milliseconds the alive time is extended when accessing this stream.protected final Map<Thread,AtomicInteger> The threads which are currently accessing this server-side proxy (and and how often).protected final Cleanup<IOException>The clean-up for closing the wrapped input stream as post-mortem action of thisServerInputStream.Fields inherited from interface de.aristaflow.adept2.model.communication.ServerSideProxy
DEFAULT_ALIVE_TIMEFields inherited from interface de.aristaflow.adept2.model.communication.TimeTrackingSsProxy
DEFAULT_CLOSE_DEFER_TIME, MAX_ALIVE_TIME_EXTENSION -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version.ServerInputStream(InputStream in, long initialAliveTime, long aliveTimeExtension) Creates a newServerInputStreamproviding the content of the designated stream incrementally on client side. -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()InputStream.close()This additionally removes the skeleton in the communication framework.longbooleanisBusy()voidmark(int readlimit) booleanintread()byte[]read(int len) ResemblesInputStream.read(byte[])by reading the designated amount of bytes from the stream.voidreset()longsetCloseTime(long closeTime) longskip(long n) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.aristaflow.adept2.model.communication.TimeTrackingSsProxy
enter, exit, getRemainingAliveTime, keepAlive
-
Field Details
-
aliveTimeExtension
protected final long aliveTimeExtensionThe time in milliseconds the alive time is extended when accessing this stream. -
busyThreads
The threads which are currently accessing this server-side proxy (and and how often). This is used to avoid closing a currently active server-side proxy. -
cleanup
The clean-up for closing the wrapped input stream as post-mortem action of thisServerInputStream.
-
-
Constructor Details
-
ServerInputStream
Deprecated, for removal: This API element is subject to removal in a future version.UseServerInputStream(InputStream, long, long)instead.Creates a newServerInputStreamproviding the content of the designated stream incrementally on client side. Note that this stream as well as the wrappedInputStreamwill be closed by the remote site. Therefore you should only close this stream (or the wrappedInputStream) if you are sure that the remote side has not closed it and will not close it, for instance since it disconnected abruptly.- Parameters:
in- The stream of which the content will be provided incrementally on client side. This stream will be closed by the remote side.
-
ServerInputStream
Creates a newServerInputStreamproviding the content of the designated stream incrementally on client side. Note that this stream as well as the wrappedInputStreamwill be closed by the remote site. Therefore you should only close this stream (or the wrappedInputStream) if you are sure that the remote side has not closed it and will not close it, for instance since it disconnected abruptly.- Parameters:
in- The stream of which the content will be provided incrementally on client side. This stream will be closed by the remote side.initialAliveTime- The initial time in milliseconds this server stream remains open before automatically being closed.aliveTimeExtension- The time in milliseconds to extend the alive time when accessing this server stream.
-
-
Method Details
-
getCloseTime
public long getCloseTime()- Specified by:
getCloseTimein interfacede.aristaflow.adept2.model.communication.TimeTrackingSsProxy
-
setCloseTime
public long setCloseTime(long closeTime) - Specified by:
setCloseTimein interfacede.aristaflow.adept2.model.communication.TimeTrackingSsProxy
-
isBusy
public boolean isBusy()- Specified by:
isBusyin interfacede.aristaflow.adept2.model.communication.TimeTrackingSsProxy
-
read
Description copied from interface:ServerStream- Specified by:
readin interfaceServerStream- Throws:
IOException
-
read
Description copied from interface:ServerStreamResemblesInputStream.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),nullwill be returned.- Specified by:
readin interfaceServerStream- Throws:
IOException
-
skip
Description copied from interface:ServerStream- Specified by:
skipin interfaceServerStream- Throws:
IOException
-
available
Description copied from interface:ServerStream- Specified by:
availablein interfaceServerStream- Throws:
IOException
-
close
Description copied from interface:ServerStreamInputStream.close()This additionally removes the skeleton in the communication framework.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfacede.aristaflow.adept2.model.communication.ServerSideProxy- Specified by:
closein interfaceServerStream- Throws:
IOException
-
mark
public void mark(int readlimit) Description copied from interface:ServerStream- Specified by:
markin interfaceServerStream
-
reset
Description copied from interface:ServerStream- Specified by:
resetin interfaceServerStream- Throws:
IOException
-
markSupported
public boolean markSupported()Description copied from interface:ServerStream- Specified by:
markSupportedin interfaceServerStream
-
ServerInputStream(InputStream, long, long)instead.