Forums Register Login

InputStream Read

+Pie Number of slices to send: Send
Hi

When reading from ServletInputStream The Stream bytes calculated in the given form:

int x =ServletInputStream.readLine(buf, 0, buf.length);

Now I would like to convert this stream to a String then validate it true in the next line.

How can I do it?
+Pie Number of slices to send: Send
If you want each line to be in its own String you could do:



You could also wrap it up something like:



Then bin.readLine() would return a String to you.

I don't know what you mean by "validate it true".
+Pie Number of slices to send: Send
Thanks Greg.

What exactly means the below String?

-----------------------------7db5ac104017fe

I still can not retrieve the exact file "line" content except from its headers.

Have another idea?




+Pie Number of slices to send: Send
 

Rico Rockbraker wrote:
What exactly means the below String?

-----------------------------7db5ac104017fe



Hey that's the VIN of my new car! How did you get it?

Wait, no it's not. Sorry. That's a delimiter you will see at the beginning of a section of an HTTP response, and there will be a matching one at the end of the section.

What problem are you seeing after you successfully read the headers? The content might not even contain lines of text, so reading it into Strings wouldn't help you.
roses are red, violets are blue. Some poems rhyme and some are a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1415 times.
Similar Threads
uploading files using servlet
OK to read the request body within a filter?
ServletInputStream class error
request.getInputStream()
Hi Please explain this..
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 08:55:40.