Hello !!!
I am trying to replace the every occurrence of text "& l t ;" to " <" in the input data in and return the converted text to the OutputStream out. When I tried to use the below code for replacing the text, it dint really replace anything. Can anyone help me to figure out my mistake ?
public void execute(InputStream in, OutputStream out){
StringBuffer str = new StringBuffer(8000);
String str1;
try {
int c;
while ((c = in.read()) != -1)
{
str.append((char)c );
}
str1 = str.toString();
str1.replaceAll(" & "," < ");
byte[] byteArray = str1.getBytes();
ByteArrayOutputStream out1 = new ByteArrayOutputStream(byteArray.length);
try
{
out.write(byteArray);
} catch(Exception e)
{
e.printStackTrace();
}
out.flush();
} catch (Exception e) { }
}
=======================================================
Edited by: Peeru Indrani on Apr 11, 2008 4:19 PM
Edited by: Peeru Indrani on Apr 11, 2008 4:20 PM