Retrieves the body of the request as binary data...
As the documentation says the method retrieves all the request data at once as "binary data" in contrast to one string per parameter. This may or may not be an advantage depending on what you want to do. In any case it's an advantage if you have for example image data in a POST request uploaded by a user and want to read this definitely binary data.
And don't forget that this method is inherited from ServletRequest. So even though almost all servlets in practice will be based on the HTTP protocol it's absolutely possible to create servlets which are using a complete different communication mechanism where it would be more useful to get any binary request data from such an input stream.
As Marco says, the method comes from ServletRequest and not HttpServletRequest and so may be used by protocols other than HTTP. Having said that, there are times when the data sent in the HttpServletRequest may not be character data, and would need to be read as a binary stream.
The default HTTP encoding is able to parse the request and inflate the data into parameters, but if the request uses an alternate encoding, like a multipart form submission (like a file upload), your servlet will get nothing useful unless you read the InputStream and parse the data yourself, or plug in another API to do it for you.
Joined: Oct 11, 2005
Marco and David , i got it now. thanks a lot...
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com