![JAR search and dependency download from the Maven repository](/logo.png)
org.spongycastle.openpgp.PGPUserAttributeSubpacketVector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcpg-jdk15on Show documentation
Show all versions of bcpg-jdk15on Show documentation
Spongy Castle is a package-rename (org.bouncycastle.* to org.spongycastle.*) of Bouncy Castle
intended for the Android platform. Android unfortunately ships with a stripped-down version of
Bouncy Castle, which prevents easy upgrades - Spongy Castle overcomes this and provides a full,
up-to-date version of the Bouncy Castle cryptographic libs.
The newest version!
package org.spongycastle.openpgp;
import org.spongycastle.bcpg.UserAttributeSubpacket;
import org.spongycastle.bcpg.UserAttributeSubpacketTags;
import org.spongycastle.bcpg.attr.ImageAttribute;
/**
* Container for a list of user attribute subpackets.
*/
public class PGPUserAttributeSubpacketVector
{
UserAttributeSubpacket[] packets;
PGPUserAttributeSubpacketVector(
UserAttributeSubpacket[] packets)
{
this.packets = packets;
}
public UserAttributeSubpacket getSubpacket(
int type)
{
for (int i = 0; i != packets.length; i++)
{
if (packets[i].getType() == type)
{
return packets[i];
}
}
return null;
}
public ImageAttribute getImageAttribute()
{
UserAttributeSubpacket p = this.getSubpacket(UserAttributeSubpacketTags.IMAGE_ATTRIBUTE);
if (p == null)
{
return null;
}
return (ImageAttribute)p;
}
UserAttributeSubpacket[] toSubpacketArray()
{
return packets;
}
public boolean equals(
Object o)
{
if (o == this)
{
return true;
}
if (o instanceof PGPUserAttributeSubpacketVector)
{
PGPUserAttributeSubpacketVector other = (PGPUserAttributeSubpacketVector)o;
if (other.packets.length != packets.length)
{
return false;
}
for (int i = 0; i != packets.length; i++)
{
if (!other.packets[i].equals(packets[i]))
{
return false;
}
}
return true;
}
return false;
}
public int hashCode()
{
int code = 0;
for (int i = 0; i != packets.length; i++)
{
code ^= packets[i].hashCode();
}
return code;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy