Class OutputConnection

  • All Implemented Interfaces:
    IConnection, IOutputConnection

    public class OutputConnection
    extends AbstractConnection
    implements IOutputConnection
    Output connection for writing data. Must synchronized its internal data because the connection handler and the connection user (i.e. a component) are using the connection concurrently. - the user calls interface methods like write and flush - the connection handler calls close to signal that the connection should close.
    • Method Detail

      • write

        public jadex.commons.future.IFuture<java.lang.Void> write​(byte[] data)
        Write the content to the stream.
        Specified by:
        write in interface IOutputConnection
        Parameters:
        data - The data.
      • waitForReady

        public jadex.commons.future.IFuture<java.lang.Integer> waitForReady()
        Wait until the connection is ready for the next write.
        Specified by:
        waitForReady in interface IOutputConnection
        Returns:
        Calls future when next data can be written. Provides a value of how much data should be given to the connection for best performance.
      • close

        public void close()
        Close the connection. Notifies the other side that the connection has been closed.
        Specified by:
        close in interface IConnection
        Overrides:
        close in class AbstractConnection
      • writeFromInputStream

        public jadex.commons.future.ISubscriptionIntermediateFuture<java.lang.Long> writeFromInputStream​(java.io.InputStream is,
                                                                                                         IExternalAccess component)
        Do write all data from the input stream.
        Specified by:
        writeFromInputStream in interface IOutputConnection
        Parameters:
        is - The input stream.