Originally posted by John Meyers:
Since every class needs to read the same data using this input stream wouldnt it be better if you made a static reference to the byte [] data so that all classes can use it once it is read ?
Originally posted by Edwin Dalorzo:
If the implementation of InputStream that you are using supports mark and reset you could use those methods to relocate the pointer at the begining of the stream after you have read it.
Simply invoke mark() at the begining of the read method and reset at the end of the reading process and then pass the stream as parameter.
I have not tested this, but it should work.
Does this help?
"I'm not back." - Bill Harding, Twister
Originally posted by Jim Yingst:
In the context of a Filter, it seems that you should be able to create your own ServletInputStream implementation that simply wraps the original ServletInputStream in a BufferedInputStream, and reads from that BIS as necessary. That allows you to also use the mark() and reset() methods as suggested above, which will work for a BIS. To pass this new ServletInputStream on to the FilterChain you'll need to create a HttpRequestWrapper implementation which returns an instance of the ServletInputStream, and pass this HttpRequestWrapper to the FilterChain with doFilter(). Does that help?
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Originally posted by Stan James:
Would FilterInputStream do the job for you
"I'm not back." - Bill Harding, Twister
Don't get me started about those stupid light bulbs. |