question: 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 ; }
target:  Create a DataSource from an input stream