Hello Friends I have a applet where an image is loaded. Now when a save button is pressed an URL connection is requested and an image is written to the ObjectOutputStream object and request to the servlet call is made. Now within the servlet i have to get the size of the image from the request input stream. Can anyone help? The reason to know this is because after I get the image from the request i would like to compress using encoder and save in database. Now I have the size in bytes after compression , But i would like to know the size before compression. Pleaseeeeee guys??? Regards Farouk
It may be a silly question, but if all you have is a single image file, why are you using an ObjectStream? If the file has been fetched from disk it probably came in as a stream of bytes, so why not just send those bytes straight to the server and convert to an object at the server end?
If this decision is out of your hands, can you tell us what Java class your transferred object is? Maybe it already has a method to get its size.