Is there a good way to replace text in a stream? I've created a servlet to read in the contents on an html page on another server and stream it out so it appears to be local. However, all relative paths are obviously broken. Below is my code so far, very simple. I have google as the URL for testing.
Joined: May 21, 2007
You _could_ use a BufferedReader instead of a BufferedInputStream, read your input line by line and process each line to do the replace before you write it out. For example (assuming you have written a method called "replaceRelativeRefs" that, given a String, returns another String in which the relative references have been replaced with absolute ones)