KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > activation > DataSource


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21
22 /*
23  * @(#)DataSource.java 1.11 05/11/16
24  *
25  * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved.
26  */

27
28 package javax.activation;
29
30 import java.io.InputStream JavaDoc;
31 import java.io.OutputStream JavaDoc;
32 import java.io.IOException JavaDoc;
33
34 /**
35  * The DataSource interface provides the JavaBeans Activation Framework
36  * with an abstraction of an arbitrary collection of data. It
37  * provides a type for that data as well as access
38  * to it in the form of <code>InputStreams</code> and
39  * <code>OutputStreams</code> where appropriate.
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 JavaDoc getInputStream() throws IOException JavaDoc;
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 JavaDoc getOutputStream() throws IOException JavaDoc;
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 JavaDoc 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 JavaDoc getName();
86 }
87
Popular Tags