tdlib-session-container/src/main/java/it/tdlight/reactiveapi/ClusterBoundResultingEventDeserializer.java

19 lines
660 B
Java
Raw Normal View History

2022-10-10 20:30:32 +02:00
package it.tdlight.reactiveapi;
import it.tdlight.reactiveapi.ResultingEvent.ClusterBoundResultingEvent;
import it.tdlight.reactiveapi.ResultingEvent.ResultingEventPublisherClosed;
import java.io.DataInput;
import java.io.IOException;
public class ClusterBoundResultingEventDeserializer implements Deserializer<ClusterBoundResultingEvent> {
@Override
public ClusterBoundResultingEvent deserialize(int length, DataInput dataInput) throws IOException {
var type = dataInput.readByte();
return switch (type) {
case 0 -> new ResultingEventPublisherClosed();
default -> throw new UnsupportedOperationException("Unsupported type: " + type);
};
}
}