1 25 package org.snipsnap.util.mail; 26 27 import javax.activation.DataSource ; 28 import java.io.IOException ; 29 import java.io.InputStream ; 30 import java.io.OutputStream ; 31 32 37 public class InputStreamDataSource implements DataSource { 38 InputStream inputStream = null; 39 String contentType = null; 40 41 public InputStreamDataSource(InputStream in, String type) { 42 inputStream = in; 43 contentType = type; 44 } 45 46 public String getContentType() { 47 return contentType; 48 } 49 50 public InputStream getInputStream() throws IOException { 51 return inputStream; 52 } 53 54 public String getName() { 55 return "unknown"; 56 } 57 58 public OutputStream getOutputStream() throws IOException { 59 throw new IOException ("InputStreamDataSource is read only"); 60 } 61 } 62 | Popular Tags |