InputStreaminput=newPipedInputStream(pipedOutputStream);intdata=input.read();while(data!=-1){//do something with data...doSomethingWithData(data);data=input.read();}input.close();
byte[]bytes=...//get byte array from somewhere.InputStreaminput=newByteArrayInputStream(bytes);intdata=input.read();while(data!=-1){//do something with datadata=input.read();}input.close();