1 /*
2 * (C) 2002 David Carr david@carr.name
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19 package net.sourceforge.mflow.api;
20
21 import java.awt.datatransfer.DataFlavor;
22
23 import javax.activation.DataHandler;
24
25 /***
26 * A JavaBean compliant wrapper for a DataHandler
27 *
28 * @author <a href="mailto:david@carr.name">David Carr</a>
29 * @version $Revision: 1.3 $
30 */
31 public interface ContentHandler {
32 /***
33 * Returns the data in its preferred Object form.
34 * <br/><br/>
35 * If the DataHandler was instantiated with an object, return the object.
36 * <br/><br/>
37 * If the DataHandler was instantiated with a DataSource, attempt to use a
38 * DataContentHandler to return an object. If no appropriate
39 * DataContentHandler can be found, get an InputStream from the DataHandler
40 * and return a byte[].
41 * <br/><br/>
42 * On error, return null.
43 *
44 * @return the content, or null on error.
45 */
46 Object getContent();
47
48 /***
49 * Return the MIME type of this object as retrieved from the source object.
50 * Note that this is the full type with parameters.
51 *
52 * @return the MIME type
53 */
54 String getContentType();
55
56 /***
57 * Replaces the internal DataHandler with one using the specified MIME type
58 *
59 * @param mimeType the new MIME type
60 */
61 void setContentType(String mimeType);
62
63 /***
64 * Replaces the internal DataHandler with one using the specified content
65 * Object
66 *
67 * @param o the new content Object
68 */
69 void setContent(Object o);
70
71 /***
72 * Returns the internal DataHandler
73 *
74 * @return the DataHandler wrapped by this class
75 */
76 DataHandler getDataHandler();
77
78 /***
79 * Return the DataFlavors in which this data is available.
80 * <br/><br/>
81 * Returns an array of DataFlavor objects indicating the flavors the data can
82 * be provided in. The array is usually ordered according to preference for
83 * providing the data, from most richly descriptive to least richly
84 * descriptive.
85 *
86 * @return an array of data flavors in which this data can be transferred
87 * @see java.awt.datatransfer.Transferable#getTransferDataFlavors()
88 */
89 DataFlavor[] getTransferDataFlavors();
90 }
This page was automatically generated by Maven