This is a definition of the current problem you come here for:
OutputStream out = ?; //what to put here? InputStream in = ?; LibraryClass1.writeDataToTheOutputStream(out); ??? // 'convert' out to in LibraryClass2.processDataFromInputStream(in);
This is the snippet of code that solves the problem using EasyStream:
final OutputStreamToInputStream<Void> out = new OutputStreamToInputStream<Void>() { @Override protected Void doRead(final InputStream istream) throws Exception { /* * Read the data from the InputStream "istream" passed as parameter. */ LibraryClass2.processDataFromInputStream(in); return null; } }; try { LibraryClass1.writeDataToTheOutputStream(out); } finally { // don't miss the close (or a thread would not terminate correctly). out.close(); }
For more options and use cases you can have a look to the reference guide.