Code example for ByteArrayOutputStream

Methods: toString

0
    public String saveTables(DriverManagerDataSource dataSource, String...tableNames)
                    throws IOException, DataSetException, SQLException, DatabaseUnitException { 
        Connection jdbcConnection = null;
        try { 
            jdbcConnection = DataSourceUtils.getConnection(dataSource);
            ByteArrayOutputStream stream = new ByteArrayOutputStream();
            FlatXmlDataSet.write(new DatabaseConnection(jdbcConnection).createDataSet(tableNames),
                                 stream);
            return stream.toString();
        } 
        finally { 
            if (null != jdbcConnection) {
                jdbcConnection.close();
            } 
            DataSourceUtils.releaseConnection(jdbcConnection, dataSource);
        } 
    } 
} 
Contextual code suggestions in your IDE  Get Codota for Java