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

com.unbound.kmip.attribute.Attributes Maven / Gradle / Ivy

Go to download

This is a collection of JAVA libraries that implement Unbound cryptographic classes for JAVA provider, PKCS11 wrapper, cryptoki, and advapi

There is a newer version: 42761
Show newest version
package com.unbound.kmip.attribute;

import com.unbound.common.Log;
import com.unbound.kmip.KMIP;
import com.unbound.kmip.KMIPConvertException;
import com.unbound.kmip.KMIPConverter;

import java.util.*;


/**
 * Created by valery.osheter on 19-Nov-15.
 */
public class Attributes extends ArrayList
{

  public void convert(KMIPConverter converter) throws KMIPConvertException
  {
    if (converter.isWrite())
    {
      for (Attribute attribute : this) Attribute.convert(converter, attribute);
    }
    else
    {
      while (converter.getNextTag() == KMIP.Tag.Attribute)
      {
        Attribute attribute = Attribute.convert(converter, null);
        add(attribute);
      }
    }
  }

  public Attribute find(int tag)
  {
    for (Attribute attribute : this)
    {
      if (attribute.tag == tag) return attribute;
    }
    return null;
  }

  public Attributes findAll(int tag)
  {
    Attributes attributes = new Attributes();
    for (Attribute attribute : this)
    {
      if (attribute.tag == tag) attributes.add(attribute);
    }
    return attributes;
  }

  public void log()
  {
    if (size()==0) return;
    Log log = Log.func("Attributes").end();
    for (Attribute attribute : this) attribute.log();
    log.leave();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy