KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > snipsnap > util > mail > InputStreamDataSource


1 /*
2  * This file is part of "SnipSnap Wiki/Weblog".
3  *
4  * Copyright (c) 2002 Stephan J. Schmidt, Matthias L. Jugel
5  * All Rights Reserved.
6  *
7  * Please visit http://snipsnap.org/ for updates and contact.
8  *
9  * --LICENSE NOTICE--
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23  * --LICENSE NOTICE--
24  */

25 package org.snipsnap.util.mail;
26
27 import javax.activation.DataSource JavaDoc;
28 import java.io.IOException JavaDoc;
29 import java.io.InputStream JavaDoc;
30 import java.io.OutputStream JavaDoc;
31
32 /**
33  * A datasource for InputStream type sources.
34  * @author Matthias L. Jugel
35  * @version $Id: InputStreamDataSource.java 645 2003-01-09 09:49:12Z stephan $
36  */

37 public class InputStreamDataSource implements DataSource JavaDoc {
38   InputStream JavaDoc inputStream = null;
39   String JavaDoc contentType = null;
40
41   public InputStreamDataSource(InputStream JavaDoc in, String JavaDoc type) {
42     inputStream = in;
43     contentType = type;
44   }
45
46   public String JavaDoc getContentType() {
47     return contentType;
48   }
49
50   public InputStream JavaDoc getInputStream() throws IOException JavaDoc {
51     return inputStream;
52   }
53
54   public String JavaDoc getName() {
55     return "unknown";
56   }
57
58   public OutputStream JavaDoc getOutputStream() throws IOException JavaDoc {
59     throw new IOException JavaDoc("InputStreamDataSource is read only");
60   }
61 }
62
Popular Tags