1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/jaf_classes/javax/activation/DataSource.java Wed Apr 27 01:27:09 2016 +0800 1.3 @@ -0,0 +1,86 @@ 1.4 +/* 1.5 + * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Oracle designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Oracle in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 + * or visit www.oracle.com if you need additional information or have any 1.26 + * questions. 1.27 + */ 1.28 + 1.29 +package javax.activation; 1.30 + 1.31 +import java.io.InputStream; 1.32 +import java.io.OutputStream; 1.33 +import java.io.IOException; 1.34 + 1.35 +/** 1.36 + * The DataSource interface provides the JavaBeans Activation Framework 1.37 + * with an abstraction of an arbitrary collection of data. It 1.38 + * provides a type for that data as well as access 1.39 + * to it in the form of <code>InputStreams</code> and 1.40 + * <code>OutputStreams</code> where appropriate. 1.41 + * 1.42 + * @since 1.6 1.43 + */ 1.44 + 1.45 +public interface DataSource { 1.46 + 1.47 + /** 1.48 + * This method returns an <code>InputStream</code> representing 1.49 + * the data and throws the appropriate exception if it can 1.50 + * not do so. Note that a new <code>InputStream</code> object must be 1.51 + * returned each time this method is called, and the stream must be 1.52 + * positioned at the beginning of the data. 1.53 + * 1.54 + * @return an InputStream 1.55 + */ 1.56 + public InputStream getInputStream() throws IOException; 1.57 + 1.58 + /** 1.59 + * This method returns an <code>OutputStream</code> where the 1.60 + * data can be written and throws the appropriate exception if it can 1.61 + * not do so. Note that a new <code>OutputStream</code> object must 1.62 + * be returned each time this method is called, and the stream must 1.63 + * be positioned at the location the data is to be written. 1.64 + * 1.65 + * @return an OutputStream 1.66 + */ 1.67 + public OutputStream getOutputStream() throws IOException; 1.68 + 1.69 + /** 1.70 + * This method returns the MIME type of the data in the form of a 1.71 + * string. It should always return a valid type. It is suggested 1.72 + * that getContentType return "application/octet-stream" if the 1.73 + * DataSource implementation can not determine the data type. 1.74 + * 1.75 + * @return the MIME Type 1.76 + */ 1.77 + public String getContentType(); 1.78 + 1.79 + /** 1.80 + * Return the <i>name</i> of this object where the name of the object 1.81 + * is dependant on the nature of the underlying objects. DataSources 1.82 + * encapsulating files may choose to return the filename of the object. 1.83 + * (Typically this would be the last component of the filename, not an 1.84 + * entire pathname.) 1.85 + * 1.86 + * @return the name of the object. 1.87 + */ 1.88 + public String getName(); 1.89 +}