In pure functional programming there is a simple rule: if you evaluate (call) a function more than once with the exact same argument values, you’ll keep getting the same return value.
Industry analyst firm RedMonk published today its latest quarterly programming language popularity ranking.
A web app in 10 minutes using Play!
Framework. Dev. Xml. Jsp. Convert a Java OutputStream to an InputStream. If you have ever programmed using Java IO, you will quickly run into a situation in which a class creates data on an OutputStream and you need to send it to another class that expects to read the data from an input stream.
You'll soon be asking the question, "How do I convert an OutputStream to an InputStream? " Nowhere in Java will you find a OutpStreamToInputStreamConverter class. Luckily, there are several ways to go about this. Method 1: Buffer the data using a byte array The easiest method is to buffer the data using a byte array. ByteArrayOutputStream out = new ByteArrayOutputStream(); class1.putDataOnOutputStream(out); class2.processDataFromInputStream( new ByteArrayInputStream(out.toByteArray()) ); That's it! Method 2: Use pipes The problem with the first method is that you must actually have enough memory to buffer the entire amount of data.