Class ServiceInputConnection
- java.lang.Object
-
- jadex.bridge.service.types.remote.ServiceInputConnection
-
- All Implemented Interfaces:
IConnection,IInputConnection
public class ServiceInputConnection extends java.lang.Object implements IInputConnection
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanclosedThe closed flag.protected IInputConnectionconThe remote output connection.protected SubscriptionIntermediateFuture<byte[]>futureThe buffer.protected ICommandtransfercommandThe transfer future.protected ITerminableIntermediateFuture<java.lang.Long>transferfutureThe transfer future.
-
Constructor Summary
Constructors Constructor Description ServiceInputConnection()Create a new service input connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ISubscriptionIntermediateFuture<byte[]>aread()Asynchronous read.intavailable()Get the number of available bytes.voidclose()Close the stream.intgetConnectionId()Get the connection id.IComponentIdentifiergetInitiator()Get the initiator.java.util.Map<java.lang.String,java.lang.Object>getNonFunctionalProperties()Get the non-functional properties of the connection.IOutputConnectiongetOutputConnection()Get the corresponding output connection.IComponentIdentifiergetParticipant()Get the participant.intread()Non-blocking read.intread(byte[] buffer)Non-blocking read.protected voidsetInputConnection(IInputConnection con)Set the input connection.ISubscriptionIntermediateFuture<java.lang.Long>writeToOutputStream(java.io.OutputStream os, IExternalAccess component)Read all data from output stream to the connection.
-
-
-
Field Detail
-
con
protected IInputConnection con
The remote output connection.
-
closed
protected boolean closed
The closed flag.
-
future
protected SubscriptionIntermediateFuture<byte[]> future
The buffer.
-
transferfuture
protected ITerminableIntermediateFuture<java.lang.Long> transferfuture
The transfer future.
-
transfercommand
protected ICommand transfercommand
The transfer future.
-
-
Method Detail
-
read
public int read()
Non-blocking read. Tries to read the next byte.- Specified by:
readin interfaceIInputConnection- Returns:
- The next byte or -1 if none is currently available.
-
read
public int read(byte[] buffer)
Non-blocking read. Tries to fill the buffer from the stream.- Specified by:
readin interfaceIInputConnection- Parameters:
buffer- The buffer to read in.- Returns:
- The number of bytes that could be read into the buffer.
-
aread
public ISubscriptionIntermediateFuture<byte[]> aread()
Asynchronous read.- Specified by:
areadin interfaceIInputConnection- Returns:
- Bytes one by one till end of stream or closed.
-
available
public int available()
Get the number of available bytes.- Specified by:
availablein interfaceIInputConnection- Returns:
- The number of available bytes.
-
getConnectionId
public int getConnectionId()
Get the connection id.- Specified by:
getConnectionIdin interfaceIConnection- Returns:
- The connection id.
-
close
public void close()
Close the stream.- Specified by:
closein interfaceIConnection
-
getInitiator
public IComponentIdentifier getInitiator()
Get the initiator.- Specified by:
getInitiatorin interfaceIConnection- Returns:
- The initiator.
-
getParticipant
public IComponentIdentifier getParticipant()
Get the participant.- Specified by:
getParticipantin interfaceIConnection- Returns:
- The participant.
-
getNonFunctionalProperties
public java.util.Map<java.lang.String,java.lang.Object> getNonFunctionalProperties()
Get the non-functional properties of the connection.- Specified by:
getNonFunctionalPropertiesin interfaceIConnection
-
setInputConnection
protected void setInputConnection(IInputConnection con)
Set the input connection.
-
getOutputConnection
public IOutputConnection getOutputConnection()
Get the corresponding output connection.
-
writeToOutputStream
public ISubscriptionIntermediateFuture<java.lang.Long> writeToOutputStream(java.io.OutputStream os, IExternalAccess component)
Read all data from output stream to the connection. The result is an intermediate future that reports back the size that was read. It can also be used to terminate reading.- Specified by:
writeToOutputStreamin interfaceIInputConnection- Parameters:
is- The input stream.component- The component.
-
-