Oops.  Forgot to change main so that it works for inputStream.  There were some allocation error too.  Added in ability to quickly check output stream as they specified.