src/share/jaf_classes/javax/activation/DataSource.java

changeset 0
373ffda63c9a
equal deleted inserted replaced
-1:000000000000 0:373ffda63c9a
1 /*
2 * Copyright (c) 1997, 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 package javax.activation;
27
28 import java.io.InputStream;
29 import java.io.OutputStream;
30 import java.io.IOException;
31
32 /**
33 * The DataSource interface provides the JavaBeans Activation Framework
34 * with an abstraction of an arbitrary collection of data. It
35 * provides a type for that data as well as access
36 * to it in the form of <code>InputStreams</code> and
37 * <code>OutputStreams</code> where appropriate.
38 *
39 * @since 1.6
40 */
41
42 public interface DataSource {
43
44 /**
45 * This method returns an <code>InputStream</code> representing
46 * the data and throws the appropriate exception if it can
47 * not do so. Note that a new <code>InputStream</code> object must be
48 * returned each time this method is called, and the stream must be
49 * positioned at the beginning of the data.
50 *
51 * @return an InputStream
52 */
53 public InputStream getInputStream() throws IOException;
54
55 /**
56 * This method returns an <code>OutputStream</code> where the
57 * data can be written and throws the appropriate exception if it can
58 * not do so. Note that a new <code>OutputStream</code> object must
59 * be returned each time this method is called, and the stream must
60 * be positioned at the location the data is to be written.
61 *
62 * @return an OutputStream
63 */
64 public OutputStream getOutputStream() throws IOException;
65
66 /**
67 * This method returns the MIME type of the data in the form of a
68 * string. It should always return a valid type. It is suggested
69 * that getContentType return "application/octet-stream" if the
70 * DataSource implementation can not determine the data type.
71 *
72 * @return the MIME Type
73 */
74 public String getContentType();
75
76 /**
77 * Return the <i>name</i> of this object where the name of the object
78 * is dependant on the nature of the underlying objects. DataSources
79 * encapsulating files may choose to return the filename of the object.
80 * (Typically this would be the last component of the filename, not an
81 * entire pathname.)
82 *
83 * @return the name of the object.
84 */
85 public String getName();
86 }

mercurial