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 boolean
closed
The closed flag.protected IInputConnection
con
The remote output connection.protected SubscriptionIntermediateFuture<byte[]>
future
The buffer.protected ICommand
transfercommand
The transfer future.protected ITerminableIntermediateFuture<java.lang.Long>
transferfuture
The 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.int
available()
Get the number of available bytes.void
close()
Close the stream.int
getConnectionId()
Get the connection id.IComponentIdentifier
getInitiator()
Get the initiator.java.util.Map<java.lang.String,java.lang.Object>
getNonFunctionalProperties()
Get the non-functional properties of the connection.IOutputConnection
getOutputConnection()
Get the corresponding output connection.IComponentIdentifier
getParticipant()
Get the participant.int
read()
Non-blocking read.int
read(byte[] buffer)
Non-blocking read.protected void
setInputConnection(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:
read
in 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:
read
in 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:
aread
in interfaceIInputConnection
- Returns:
- Bytes one by one till end of stream or closed.
-
available
public int available()
Get the number of available bytes.- Specified by:
available
in interfaceIInputConnection
- Returns:
- The number of available bytes.
-
getConnectionId
public int getConnectionId()
Get the connection id.- Specified by:
getConnectionId
in interfaceIConnection
- Returns:
- The connection id.
-
close
public void close()
Close the stream.- Specified by:
close
in interfaceIConnection
-
getInitiator
public IComponentIdentifier getInitiator()
Get the initiator.- Specified by:
getInitiator
in interfaceIConnection
- Returns:
- The initiator.
-
getParticipant
public IComponentIdentifier getParticipant()
Get the participant.- Specified by:
getParticipant
in 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:
getNonFunctionalProperties
in 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:
writeToOutputStream
in interfaceIInputConnection
- Parameters:
is
- The input stream.component
- The component.
-
-