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

swim.mqtt.MqttEncoder Maven / Gradle / Ivy

Go to download

MQTT packet model and wire protocol codec that incrementally decodes and encodes MQTT streams without intermediate buffering

The newest version!
// Copyright 2015-2024 Nstream, inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package swim.mqtt;

import swim.codec.Encoder;
import swim.codec.OutputBuffer;
import swim.structure.Data;

public class MqttEncoder {

  public MqttEncoder() {
    // nop
  }

  public Encoder connectPacketEncoder(MqttConnectPacket packet) {
    return new MqttConnectPacketEncoder(this, packet);
  }

  public Encoder encodeConnectPacket(OutputBuffer output, MqttConnectPacket packet) {
    return MqttConnectPacketEncoder.encode(output, this, packet);
  }

  public Encoder connAckPacketEncoder(MqttConnAckPacket packet) {
    return new MqttConnAckPacketEncoder(this, packet);
  }

  public Encoder encodeConnAckPacket(OutputBuffer output, MqttConnAckPacket packet) {
    return MqttConnAckPacketEncoder.encode(output, this, packet);
  }

  public  Encoder> publishPacketEncoder(MqttPublishPacket packet) {
    return new MqttPublishPacketEncoder(this, packet);
  }

  public  Encoder> encodePublishPacket(OutputBuffer output, MqttPublishPacket packet) {
    return MqttPublishPacketEncoder.encode(output, this, packet);
  }

  public Encoder pubAckPacketEncoder(MqttPubAckPacket packet) {
    return new MqttPubAckPacketEncoder(this, packet);
  }

  public Encoder encodePubAckPacket(OutputBuffer output, MqttPubAckPacket packet) {
    return MqttPubAckPacketEncoder.encode(output, this, packet);
  }

  public Encoder pubRecPacketEncoder(MqttPubRecPacket packet) {
    return new MqttPubRecPacketEncoder(this, packet);
  }

  public Encoder encodePubRecPacket(OutputBuffer output, MqttPubRecPacket packet) {
    return MqttPubRecPacketEncoder.encode(output, this, packet);
  }

  public Encoder pubRelPacketEncoder(MqttPubRelPacket packet) {
    return new MqttPubRelPacketEncoder(this, packet);
  }

  public Encoder encodePubRelPacket(OutputBuffer output, MqttPubRelPacket packet) {
    return MqttPubRelPacketEncoder.encode(output, this, packet);
  }

  public Encoder pubCompPacketEncoder(MqttPubCompPacket packet) {
    return new MqttPubCompPacketEncoder(this, packet);
  }

  public Encoder encodePubCompPacket(OutputBuffer output, MqttPubCompPacket packet) {
    return MqttPubCompPacketEncoder.encode(output, this, packet);
  }

  public Encoder subscribePacketEncoder(MqttSubscribePacket packet) {
    return new MqttSubscribePacketEncoder(this, packet);
  }

  public Encoder encodeSubscribePacket(OutputBuffer output, MqttSubscribePacket packet) {
    return MqttSubscribePacketEncoder.encode(output, this, packet);
  }

  public Encoder subAckPacketEncoder(MqttSubAckPacket packet) {
    return new MqttSubAckPacketEncoder(this, packet);
  }

  public Encoder encodeSubAckPacket(OutputBuffer output, MqttSubAckPacket packet) {
    return MqttSubAckPacketEncoder.encode(output, this, packet);
  }

  public Encoder unsubscribePacketEncoder(MqttUnsubscribePacket packet) {
    return new MqttUnsubscribePacketEncoder(this, packet);
  }

  public Encoder encodeUnsubscribePacket(OutputBuffer output, MqttUnsubscribePacket packet) {
    return MqttUnsubscribePacketEncoder.encode(output, this, packet);
  }

  public Encoder unsubAckPacketEncoder(MqttUnsubAckPacket packet) {
    return new MqttUnsubAckPacketEncoder(this, packet);
  }

  public Encoder encodeUnsubAckPacket(OutputBuffer output, MqttUnsubAckPacket packet) {
    return MqttUnsubAckPacketEncoder.encode(output, this, packet);
  }

  public Encoder pingReqPacketEncoder(MqttPingReqPacket packet) {
    return new MqttPingReqPacketEncoder(this, packet);
  }

  public Encoder encodePingReqPacket(OutputBuffer output, MqttPingReqPacket packet) {
    return MqttPingReqPacketEncoder.encode(output, this, packet);
  }

  public Encoder pingRespPacketEncoder(MqttPingRespPacket packet) {
    return new MqttPingRespPacketEncoder(this, packet);
  }

  public Encoder encodePingRespPacket(OutputBuffer output, MqttPingRespPacket packet) {
    return MqttPingRespPacketEncoder.encode(output, this, packet);
  }

  public Encoder disconnectPacketEncoder(MqttDisconnectPacket packet) {
    return new MqttDisconnectPacketEncoder(this, packet);
  }

  public Encoder encodeDisconnectPacket(OutputBuffer output, MqttDisconnectPacket packet) {
    return MqttDisconnectPacketEncoder.encode(output, this, packet);
  }

  public int sizeOfSubscription(MqttSubscription subscription) {
    return MqttSubscriptionEncoder.sizeOf(this, subscription);
  }

  public Encoder subscriptionEncoder(MqttSubscription subscription) {
    return new MqttSubscriptionEncoder(this, subscription);
  }

  public Encoder encodeSubscription(OutputBuffer output, MqttSubscription subscription) {
    return MqttSubscriptionEncoder.encode(output, this, subscription);
  }

  public int sizeOfString(String string) {
    return MqttStringEncoder.sizeOf(string);
  }

  public Encoder stringEncoder(String string) {
    return new MqttStringEncoder(string);
  }

  public Encoder encodeString(OutputBuffer output, String string) {
    return MqttStringEncoder.encode(output, string);
  }

  public int sizeOfData(Data data) {
    return MqttDataEncoder.sizeOf(data);
  }

  public Encoder dataEncoder(Data data) {
    return new MqttDataEncoder(data);
  }

  public Encoder encodeData(OutputBuffer output, Data data) {
    return MqttDataEncoder.encode(output, data);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy