Here you can find the source of encodeTextValue(char[] characters, int offset, int length, Writer writer)
public static void encodeTextValue(char[] characters, int offset, int length, Writer writer) throws IOException
//package com.java2s; /*//from w w w . j ava2 s . c o m Milyn - Copyright (C) 2006 - 2010 This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (version 2.1) as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details: http://www.gnu.org/licenses/lgpl.txt */ import java.io.IOException; import java.io.Writer; public class Main { public static final char[] LT = new char[] { '&', 'l', 't', ';' }; public static final char[] GT = new char[] { '&', 'g', 't', ';' }; public static final char[] AMP = new char[] { '&', 'a', 'm', 'p', ';' }; public static void encodeTextValue(char[] characters, int offset, int length, Writer writer) throws IOException { for (int i = offset; i < offset + length; i++) { char c = characters[i]; switch (c) { case '<': writer.write(LT, 0, LT.length); break; case '>': writer.write(GT, 0, GT.length); break; case '&': writer.write(AMP, 0, AMP.length); break; default: writer.write(c); } } } }