// ClobDataSource.java // part of the webmail ACS module // written by Jin Choi // 2000-03-01 // This class provides a wrapper for CLOBs so that we can // stuff them into Messages. package acspg; import javax.activation.*; import java.sql.*; import java.io.*; import acspg.*; public class ClobDataSource implements DataSource { protected CLOB clob; protected String contentType; protected String name; public ClobDataSource(CLOB clob, String contentType, String name) { this.clob = clob; this.contentType = contentType; this.name = name; } public InputStream getInputStream() throws IOException { try { return clob.getAsciiStream(); } catch (Exception e) { throw new IOException("SQL Exception caught: " + e.getMessage()); } } public OutputStream getOutputStream() throws IOException { throw new IOException("cannot do this"); } public String getContentType() { return contentType; } public String getName() { return name; } };