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

org.kafkacrypto.msgs.CertPoisons Maven / Gradle / Ivy

Go to download

Java port of kafkacrypto, a lightweight and cross-platform/cross-language encryption library for Apache Kafka.

There is a newer version: 0.9.11.0
Show newest version
package org.kafkacrypto.msgs;

import org.kafkacrypto.msgs.CertPoison;
import org.kafkacrypto.msgs.msgpack;
import org.kafkacrypto.msgs.Msgpacker;

import org.msgpack.core.MessagePack;
import org.msgpack.core.MessageBufferPacker;
import org.msgpack.core.MessagePacker;
import java.util.List;
import java.util.ArrayList;
import org.msgpack.value.Value;

import java.io.IOException;

public class CertPoisons extends ArrayList implements Msgpacker
{

  public CertPoisons unpackb(List src) throws IOException
  {
    for (int i = 0; i < src.size(); i++)
      this.add(CertPoison.unpackb(src.get(i).asArrayValue().list()));
    return this;
  }

  public void packb(MessagePacker packer) throws IOException
  {
    msgpack.packb_recurse(packer, this.packb_internal());
  }

  public byte[] packb_internal() throws IOException
  {
    MessageBufferPacker packer2 = MessagePack.DEFAULT_PACKER_CONFIG.withStr8FormatSupport(false).newBufferPacker();
    packer2.packArrayHeader(this.size());
    for (int i = 0; i < this.size(); i++)
      msgpack.packb_recurse(packer2, this.get(i));
    packer2.close();
    return packer2.toByteArray();
  }

  public String toString()
  {
    StringBuilder sb = new StringBuilder();
    sb.append("[");
    for (int i = 0; i < this.size(); i++) {
      if (i > 0)
        sb.append(", ");
      sb.append(this.get(i).toString());
    }
    sb.append("]");
    return sb.toString();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy