01: package org.bouncycastle.bcpg.attr;
02:
03: import org.bouncycastle.bcpg.UserAttributeSubpacket;
04: import org.bouncycastle.bcpg.UserAttributeSubpacketTags;
05:
06: /**
07: * Basic type for a image attribute packet.
08: */
09: public class ImageAttribute extends UserAttributeSubpacket {
10: private int hdrLength;
11: private int version;
12: private int encoding;
13: private byte[] imageData;
14:
15: public ImageAttribute(byte[] data) {
16: super (UserAttributeSubpacketTags.IMAGE_ATTRIBUTE, data);
17:
18: hdrLength = ((data[1] & 0xff) << 8) | (data[0] & 0xff);
19: version = data[2] & 0xff;
20: encoding = data[3] & 0xff;
21:
22: imageData = new byte[data.length - hdrLength];
23: System.arraycopy(data, hdrLength, imageData, 0,
24: imageData.length);
25: }
26:
27: public int version() {
28: return version;
29: }
30:
31: public int getEncoding() {
32: return encoding;
33: }
34:
35: public byte[] getImageData() {
36: return imageData;
37: }
38: }
|