Ver Mensaje Individual
  #3 (permalink)  
Antiguo 01/04/2003, 06:50
alcoholyvendas
 
Fecha de Ingreso: abril-2003
Mensajes: 3
Antigüedad: 21 años
Puntos: 0
Aqui va el resto, kolega , de la vega.

import java.util.*;
import java.io.*;
import javax.activation.*;

/** DataSource para cualquier texto plano. */
public class SMTPByteArrayDataSource implements DataSource {

private byte[] data;
private String type;

SMTPByteArrayDataSource( InputStream is, String type) {
this.type = type;
try {
ByteArrayOutputStream os = new ByteArrayOutputStream();
int ch;
while ( ( ch = is.read()) != -1) { os.write(ch);}
data = os.toByteArray();
} catch (IOException ioex){}
}

SMTPByteArrayDataSource( byte[] data, String type) {
this.data = data;
this.type = type;
}

SMTPByteArrayDataSource( String data, String type) {
this.data = data.getBytes();
this.type = type;
}

public InputStream getInputStream() throws IOException
{
if ( data == null) { throw new IOException( "No hay datos");}
return new ByteArrayInputStream( data);
}

public OutputStream getOutputStream() throws IOException {
throw new IOException( "No esta implementado");
}
public String getContentType() { return type;}
public String getName() {return "dummy";}
}