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

com.cisco.trex.stateful.api.lowlevel.ASTFCmd Maven / Gradle / Ivy

There is a newer version: 1.69
Show newest version
package com.cisco.trex.stateful.api.lowlevel;

import com.google.gson.JsonObject;
import java.util.Base64;

/** Java implementation for TRex python sdk ASTFCmd class, the abstract Astf Cmd class, */
public abstract class ASTFCmd {

  protected JsonObject fields;
  protected Boolean stream = null;
  protected Boolean buffer = false;

  /** construct */
  public ASTFCmd() {
    fields = new JsonObject();
  }

  /**
   * get AstfCmd name
   *
   * @return Astf cmd name
   */
  public abstract String getName();

  /**
   * isStream
   *
   * @return true if it's stream
   */
  public Boolean isStream() {
    return stream;
  }

  /**
   * to json format
   *
   * @return JsonObject
   */
  public JsonObject toJson() {
    return fields;
  }

  /**
   * isBuffer
   *
   * @return true if it's buffer
   */
  public Boolean isBuffer() {
    return buffer;
  }

  public static String encodeBase64(byte[] bytes) {
    Base64.Encoder encoder = Base64.getEncoder();
    return encoder.encodeToString(bytes);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy