• Post Reply Bookmark Topic Watch Topic
  • New Topic

InputStream Read

 
Rico Rockbraker
Greenhorn
Posts: 7
Java MyEclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Greg Charles
Sheriff
Posts: 3010
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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".
 
Rico Rockbraker
Greenhorn
Posts: 7
Java MyEclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?




 
Greg Charles
Sheriff
Posts: 3010
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!