All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.firefly.net.tcp.codec.flex.stream.Stream Maven / Gradle / Ivy

There is a newer version: 5.0.0-dev6
Show newest version
package com.firefly.net.tcp.codec.flex.stream;

import com.firefly.net.tcp.codec.flex.protocol.ControlFrame;
import com.firefly.net.tcp.codec.flex.protocol.DataFrame;
import com.firefly.utils.concurrent.Callback;

import java.util.concurrent.CompletableFuture;

/**
 * @author Pengtao Qiu
 */
public interface Stream extends ContextAttribute {

    int getId();

    CompletableFuture send(ControlFrame controlFrame);

    CompletableFuture send(DataFrame dataFrame);

    void send(ControlFrame controlFrame, Callback callback);

    void send(DataFrame dataFrame, Callback callback);

    void setListener(Listener listener);

    State getState();

    Session getSession();

    boolean isCommitted();

    interface Listener {
        void onControl(ControlFrame controlFrame);

        void onData(DataFrame dataFrame);
    }

    enum State {
        OPEN, LOCALLY_CLOSED, REMOTELY_CLOSED, CLOSED
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy