KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > xml > crypto > OctetStreamData


1 /*
2  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
3  *
4  * @author Sean Mullan
5  * @author JSR 105 Expert Group
6  */

7 /*
8  * $Id: OctetStreamData.java,v 1.3 2005/05/10 15:47:42 mullan Exp $
9  */

10 package javax.xml.crypto;
11
12 import java.io.InputStream JavaDoc;
13
14 /**
15  * A representation of a <code>Data</code> type containing an octet stream.
16  *
17  * @since 1.6
18  */

19 public class OctetStreamData implements Data {
20   
21     private InputStream JavaDoc octetStream;
22     private String JavaDoc uri;
23     private String JavaDoc mimeType;
24
25     /**
26      * Creates a new <code>OctetStreamData</code>.
27      *
28      * @param octetStream the input stream containing the octets
29      * @throws NullPointerException if <code>octetStream</code> is
30      * <code>null</code>
31      */

32     public OctetStreamData(InputStream JavaDoc octetStream) {
33     if (octetStream == null) {
34         throw new NullPointerException JavaDoc("octetStream is null");
35     }
36     this.octetStream = octetStream;
37     }
38
39     /**
40      * Creates a new <code>OctetStreamData</code>.
41      *
42      * @param octetStream the input stream containing the octets
43      * @param uri the URI String identifying the data object (may be
44      * <code>null</code>)
45      * @param mimeType the MIME type associated with the data object (may be
46      * <code>null</code>)
47      * @throws NullPointerException if <code>octetStream</code> is
48      * <code>null</code>
49      */

50     public OctetStreamData(InputStream JavaDoc octetStream, String JavaDoc uri,
51     String JavaDoc mimeType) {
52     if (octetStream == null) {
53         throw new NullPointerException JavaDoc("octetStream is null");
54     }
55     this.octetStream = octetStream;
56     this.uri = uri;
57     this.mimeType = mimeType;
58     }
59
60     /**
61      * Returns the input stream of this <code>OctetStreamData</code>.
62      *
63      * @return the input stream of this <code>OctetStreamData</code>.
64      */

65     public InputStream JavaDoc getOctetStream() {
66     return octetStream;
67     }
68
69     /**
70      * Returns the URI String identifying the data object represented by this
71      * <code>OctetStreamData</code>.
72      *
73      * @return the URI String or <code>null</code> if not applicable
74      */

75     public String JavaDoc getURI() {
76     return uri;
77     }
78
79     /**
80      * Returns the MIME type associated with the data object represented by this
81      * <code>OctetStreamData</code>.
82      *
83      * @return the MIME type or <code>null</code> if not applicable
84      */

85     public String JavaDoc getMimeType() {
86     return mimeType;
87     }
88 }
89
Popular Tags