Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.xml.crypto/share/classes/javax/xml/crypto/OctetStreamData.java
41159 views
1
/*
2
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
/*
26
* $Id: OctetStreamData.java,v 1.3 2005/05/10 15:47:42 mullan Exp $
27
*/
28
package javax.xml.crypto;
29
30
import java.io.InputStream;
31
32
/**
33
* A representation of a <code>Data</code> type containing an octet stream.
34
*
35
* @since 1.6
36
*/
37
public class OctetStreamData implements Data {
38
39
private InputStream octetStream;
40
private String uri;
41
private String mimeType;
42
43
/**
44
* Creates a new <code>OctetStreamData</code>.
45
*
46
* @param octetStream the input stream containing the octets
47
* @throws NullPointerException if <code>octetStream</code> is
48
* <code>null</code>
49
*/
50
public OctetStreamData(InputStream octetStream) {
51
if (octetStream == null) {
52
throw new NullPointerException("octetStream is null");
53
}
54
this.octetStream = octetStream;
55
}
56
57
/**
58
* Creates a new <code>OctetStreamData</code>.
59
*
60
* @param octetStream the input stream containing the octets
61
* @param uri the URI String identifying the data object (may be
62
* <code>null</code>)
63
* @param mimeType the MIME type associated with the data object (may be
64
* <code>null</code>)
65
* @throws NullPointerException if <code>octetStream</code> is
66
* <code>null</code>
67
*/
68
public OctetStreamData(InputStream octetStream, String uri,
69
String mimeType) {
70
if (octetStream == null) {
71
throw new NullPointerException("octetStream is null");
72
}
73
this.octetStream = octetStream;
74
this.uri = uri;
75
this.mimeType = mimeType;
76
}
77
78
/**
79
* Returns the input stream of this <code>OctetStreamData</code>.
80
*
81
* @return the input stream of this <code>OctetStreamData</code>.
82
*/
83
public InputStream getOctetStream() {
84
return octetStream;
85
}
86
87
/**
88
* Returns the URI String identifying the data object represented by this
89
* <code>OctetStreamData</code>.
90
*
91
* @return the URI String or <code>null</code> if not applicable
92
*/
93
public String getURI() {
94
return uri;
95
}
96
97
/**
98
* Returns the MIME type associated with the data object represented by this
99
* <code>OctetStreamData</code>.
100
*
101
* @return the MIME type or <code>null</code> if not applicable
102
*/
103
public String getMimeType() {
104
return mimeType;
105
}
106
}
107
108