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