1 package org.bouncycastle.util.io.pem;
2 
3 import java.util.ArrayList;
4 import java.util.Collections;
5 import java.util.List;
6 
7 /**
8  * A generic PEM object - type, header properties, and byte content.
9  */
10 public class PemObject
11     implements PemObjectGenerator
12 {
13     private static final List EMPTY_LIST = Collections.unmodifiableList(new ArrayList());
14 
15     private String type;
16     private List   headers;
17     private byte[] content;
18 
19     /**
20      * Generic constructor for object without headers.
21      *
22      * @param type pem object type.
23      * @param content the binary content of the object.
24      */
PemObject(String type, byte[] content)25     public PemObject(String type, byte[] content)
26     {
27         this(type, EMPTY_LIST, content);
28     }
29 
30     /**
31      * Generic constructor for object with headers.
32      *
33      * @param type pem object type.
34      * @param headers a list of PemHeader objects.
35      * @param content the binary content of the object.
36      */
PemObject(String type, List headers, byte[] content)37     public PemObject(String type, List headers, byte[] content)
38     {
39         this.type = type;
40         this.headers = Collections.unmodifiableList(headers);
41         this.content = content;
42     }
43 
getType()44     public String getType()
45     {
46         return type;
47     }
48 
getHeaders()49     public List getHeaders()
50     {
51         return headers;
52     }
53 
getContent()54     public byte[] getContent()
55     {
56         return content;
57     }
58 
generate()59     public PemObject generate()
60         throws PemGenerationException
61     {
62         return this;
63     }
64 }
65