Path: blob/master/src/java.xml.crypto/share/classes/javax/xml/crypto/OctetStreamData.java
41159 views
/*1* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/24/*25* $Id: OctetStreamData.java,v 1.3 2005/05/10 15:47:42 mullan Exp $26*/27package javax.xml.crypto;2829import java.io.InputStream;3031/**32* A representation of a <code>Data</code> type containing an octet stream.33*34* @since 1.635*/36public class OctetStreamData implements Data {3738private InputStream octetStream;39private String uri;40private String mimeType;4142/**43* Creates a new <code>OctetStreamData</code>.44*45* @param octetStream the input stream containing the octets46* @throws NullPointerException if <code>octetStream</code> is47* <code>null</code>48*/49public OctetStreamData(InputStream octetStream) {50if (octetStream == null) {51throw new NullPointerException("octetStream is null");52}53this.octetStream = octetStream;54}5556/**57* Creates a new <code>OctetStreamData</code>.58*59* @param octetStream the input stream containing the octets60* @param uri the URI String identifying the data object (may be61* <code>null</code>)62* @param mimeType the MIME type associated with the data object (may be63* <code>null</code>)64* @throws NullPointerException if <code>octetStream</code> is65* <code>null</code>66*/67public OctetStreamData(InputStream octetStream, String uri,68String mimeType) {69if (octetStream == null) {70throw new NullPointerException("octetStream is null");71}72this.octetStream = octetStream;73this.uri = uri;74this.mimeType = mimeType;75}7677/**78* Returns the input stream of this <code>OctetStreamData</code>.79*80* @return the input stream of this <code>OctetStreamData</code>.81*/82public InputStream getOctetStream() {83return octetStream;84}8586/**87* Returns the URI String identifying the data object represented by this88* <code>OctetStreamData</code>.89*90* @return the URI String or <code>null</code> if not applicable91*/92public String getURI() {93return uri;94}9596/**97* Returns the MIME type associated with the data object represented by this98* <code>OctetStreamData</code>.99*100* @return the MIME type or <code>null</code> if not applicable101*/102public String getMimeType() {103return mimeType;104}105}106107108