The DataHanderDataSource class implements the DataSource interface when the DataHandler is constructed with an Object and a mimeType string.
| 709 | * with an Object and a mimeType string. |
| 710 | */ |
| 711 | class DataHandlerDataSource implements DataSource { |
| 712 | DataHandler dataHandler = null; |
| 713 | |
| 714 | /** |
| 715 | * The constructor. |
| 716 | */ |
| 717 | public DataHandlerDataSource(DataHandler dh) { |
| 718 | this.dataHandler = dh; |
| 719 | } |
| 720 | |
| 721 | /** |
| 722 | * Returns an <code>InputStream</code> representing this object. |
| 723 | * @return the <code>InputStream</code> |
| 724 | */ |
| 725 | public InputStream getInputStream() throws IOException { |
| 726 | return dataHandler.getInputStream(); |
| 727 | } |
| 728 | |
| 729 | /** |
| 730 | * Returns the <code>OutputStream</code> for this object. |
| 731 | * @return the <code>OutputStream</code> |
| 732 | */ |
| 733 | public OutputStream getOutputStream() throws IOException { |
| 734 | return dataHandler.getOutputStream(); |
| 735 | } |
| 736 | |
| 737 | /** |
| 738 | * Returns the MIME type of the data represented by this object. |
| 739 | * @return the MIME type |
| 740 | */ |
| 741 | public String getContentType() { |
| 742 | return dataHandler.getContentType(); |
| 743 | } |
| 744 | |
| 745 | /** |
| 746 | * Returns the name of this object. |
| 747 | * @return the name of this object |
| 748 | */ |
| 749 | public String getName() { |
| 750 | return dataHandler.getName(); // what else would it be? |
| 751 | } |
| 752 | } |
| 753 | |
| 754 | /* |
| 755 | * DataSourceDataContentHandler |
nothing calls this directly
no outgoing calls
no test coverage detected