java.net.URLDecoder for StringBuffer or InputStream

H

HK

Hi,

java.net.URLDecoder has only a method to decode a String into
a result String. Does anyone know of an InputStream or rather
Reader version?

(I thought I could answer HTTP POST requests in a
streaming fashion, i.e. starting to generate the output
while still data is coming in. But maybe this would not
work anyway?)

Harald Kirsch
 
R

Ryan Stewart

HK said:
Hi,

java.net.URLDecoder has only a method to decode a String into
a result String. Does anyone know of an InputStream or rather
Reader version?

(I thought I could answer HTTP POST requests in a
streaming fashion, i.e. starting to generate the output
while still data is coming in. But maybe this would not
work anyway?)
That's probably not a good idea. How do you know what to give someone if you
don't know what all they're asking for?
 
H

HK

Ryan said:
That's probably not a good idea. How do you know what to give someone if you
don't know what all they're asking for?

I want to filter data in the same fashion sed/awk/cat/tr you name it
filter data. Since the Web it seems this technique is almost
forgotton. First read all the data, fill your memory belly
until it almost bursts, choke, digest, trundle about and finally
respond is what seems to be fashionable today.-)

Sorry for the rant, but I am having a hard time convincing some
folks of the benefits of filtering/pipelining despite the fact that
their jaws drop when they see how responsive/fast software can be!-)
Harald.
 
R

Ryan Stewart

HK said:
I want to filter data in the same fashion sed/awk/cat/tr you name it
filter data. Since the Web it seems this technique is almost
forgotton. First read all the data, fill your memory belly
until it almost bursts, choke, digest, trundle about and finally
respond is what seems to be fashionable today.-)

Sorry for the rant, but I am having a hard time convincing some
folks of the benefits of filtering/pipelining despite the fact that
their jaws drop when they see how responsive/fast software can be!-)
Harald.
Well, the decoding rules are laid out in the documentation of URLDecoder. It
would be very simple to write your own decoder class that would work with
InputStreams, Readers, or whatever else you wanted.

I'm not following you completely. What exactly are you trying to do? Decode the
data as it comes in rather than read it all and then decode it? If that's the
case, rather than write just a decoder, you might consider extending a Reader or
other input class and make a URLReader (or whatever): you would use this class
rather than, say, a BufferedReader to read the incoming data, and the reader
itself would decode it for you. I did something similar with a Writer to remove
extraneous white space from HTML HTTP responses. Obviously that worked the other
way around.
 
H

HK

Ryan said:
it

Decode the
data as it comes in rather than read it all and then decode it? If that's the
case, rather than write just a decoder, you might consider extending a Reader or
other input class and make a URLReader (or whatever):

Indeed, this is exactly what I want. I was just a bit surprised
that there is nothing like this available already and thought
I might have missed it.

Thanks,
Harald.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top