Java tutorial
//package com.java2s; import java.io.IOException; import java.io.OutputStream; public class Main { public static void printTextValue(OutputStream out, String str) throws IOException { str = str.replaceAll("&", "&"); //$NON-NLS-1$ //$NON-NLS-2$ str = str.replaceAll(">", ">"); //$NON-NLS-1$ //$NON-NLS-2$ str = str.replaceAll("<", "<"); //$NON-NLS-1$ //$NON-NLS-2$ print(out, str); } public static void print(OutputStream out, String str) throws IOException { out.write(str.getBytes("UTF-8")); //$NON-NLS-1$ } }