public ByteArrayDataSource(InputStream is,String type){
  try {
    ByteArrayOutputStream os=new ByteArrayOutputStream();
    int ch;
    while ((ch=is.read()) != -1) {
      os.write(ch);
    }
    m_data=os.toByteArray();
  }
 catch (  IOException ioex) {
    log.log(Level.WARNING,"",ioex);
  }
  if (type != null && type.length() > 0)   m_type=type;
}

public ByteArrayDataSource ( InputStream is , String type ) { try { ByteArrayOutputStream os = new ByteArrayOutputStream ( ) ; int ch ; while ( ( ch = is . read ( ) ) != - 1 ) { os . write ( ch ) ; } m_data = os . toByteArray ( ) ; } catch ( IOException ioex ) { log . log ( Level . WARNING , "" , ioex ) ; } if ( type != null && type . length ( ) > 0 ) m_type = type ; }
create a datasource from an input stream
