/** * <p> * Adds entities to this entity. * </p> * * @param entityArray * array of entities to be added */ public void addEntities(String[][] entityArray) { for (String[] anEntityArray : entityArray) { addEntity(anEntityArray[0], Integer.parseInt(anEntityArray[1])); } }
/** * <p> * Escapes the characters in a <code>String</code>. * </p> * * <p> * For example, if you have called addEntity("foo", 0xA1), escape("\u00A1") will return * "&foo;" * </p> * * @param str * The <code>String</code> to escape. * @return A new escaped <code>String</code>. */ public String escape(String str) { StringBuilder sb = createStringBuilder(str); escape(sb, str); return sb.toString(); }
/** * <p> * Unescapes the entities in a <code>String</code>. * </p> * * <p> * For example, if you have called addEntity("foo", 0xA1), unescape("&foo;") will return * "\u00A1" * </p> * * @param str * The <code>String</code> to escape. * @return A new escaped <code>String</code>. */ public String unescape(String str) { int firstAmp = str.indexOf('&'); if (firstAmp < 0) { return str; } else { StringBuilder sb = createStringBuilder(str); doUnescape(sb, str, firstAmp); return sb.toString(); } }
@Deprecated public void unescape(Writer writer, String str) throws IOException { writer.write(unescape(str)); }
/** * <p> * Unescapes the escaped entities in the <code>String</code> passed and writes the result to the * <code>StringBuilder</code> passed. * </p> * * @param sb * The <code>StringBuilder</code> to write the results to; assumed to be non-null. * @param str * The source <code>String</code> to unescape; assumed to be non-null. * * @see #escape(String) * @see java.lang.StringBuilder */ public void unescape(StringBuilder sb, String str) { int firstAmp = str.indexOf('&'); if (firstAmp < 0) { sb.append(str); } else { doUnescape(sb, str, firstAmp); } }
for (int i = 0; i < len; i++) { char c = str.charAt(i); String entityName = this.entityName(c); if (entityName == null) { if (c > 0x7F) {
entityValue = this.entityValue(entityContent);
@Deprecated public void escape(Writer writer, String str) throws IOException { writer.write(unescape(str)); }
/** * <p> * Unescapes the escaped entities in the <code>String</code> passed and writes the result to the * <code>StringBuilder</code> passed. * </p> * * @param sb * The <code>StringBuilder</code> to write the results to; assumed to be non-null. * @param str * The source <code>String</code> to unescape; assumed to be non-null. * * @see #escape(String) * @see java.lang.StringBuilder */ public void unescape(StringBuilder sb, String str) { int firstAmp = str.indexOf('&'); if (firstAmp < 0) { sb.append(str); } else { doUnescape(sb, str, firstAmp); } }
for (int i = 0; i < len; i++) { char c = str.charAt(i); String entityName = this.entityName(c); if (entityName == null) { if (c > 0x7F) {
entityValue = this.entityValue(entityContent);
/** * <p> * Escapes the characters in a <code>String</code>. * </p> * * <p> * For example, if you have called addEntity("foo", 0xA1), escape("\u00A1") will return * "&foo;" * </p> * * @param str * The <code>String</code> to escape. * @return A new escaped <code>String</code>. */ public String escape(String str) { StringBuilder sb = createStringBuilder(str); escape(sb, str); return sb.toString(); }
/** * <p> * Unescapes the entities in a <code>String</code>. * </p> * * <p> * For example, if you have called addEntity("foo", 0xA1), unescape("&foo;") will return * "\u00A1" * </p> * * @param str * The <code>String</code> to escape. * @return A new escaped <code>String</code>. */ public String unescape(String str) { int firstAmp = str.indexOf('&'); if (firstAmp < 0) { return str; } else { StringBuilder sb = createStringBuilder(str); doUnescape(sb, str, firstAmp); return sb.toString(); } }
@Deprecated public void escape(Writer writer, String str) throws IOException { writer.write(unescape(str)); }
/** * <p> * Adds entities to this entity. * </p> * * @param entityArray * array of entities to be added */ public void addEntities(String[][] entityArray) { for (String[] anEntityArray : entityArray) { addEntity(anEntityArray[0], Integer.parseInt(anEntityArray[1])); } }
/** * <p> * Unescapes the escaped entities in the <code>String</code> passed and writes the result to the * <code>StringBuilder</code> passed. * </p> * * @param sb * The <code>StringBuilder</code> to write the results to; assumed to be non-null. * @param str * The source <code>String</code> to unescape; assumed to be non-null. * * @see #escape(String) * @see java.lang.StringBuilder */ public void unescape(StringBuilder sb, String str) { int firstAmp = str.indexOf('&'); if (firstAmp < 0) { sb.append(str); } else { doUnescape(sb, str, firstAmp); } }
for (int i = 0; i < len; i++) { char c = str.charAt(i); String entityName = this.entityName(c); if (entityName == null) { if (c > 0x7F) {
entityValue = this.entityValue(entityContent);
/** * <p> * Escapes the characters in a <code>String</code>. * </p> * * <p> * For example, if you have called addEntity("foo", 0xA1), escape("\u00A1") will return * "&foo;" * </p> * * @param str * The <code>String</code> to escape. * @return A new escaped <code>String</code>. */ public String escape(String str) { StringBuilder sb = createStringBuilder(str); escape(sb, str); return sb.toString(); }
/** * <p> * Unescapes the entities in a <code>String</code>. * </p> * * <p> * For example, if you have called addEntity("foo", 0xA1), unescape("&foo;") will return * "\u00A1" * </p> * * @param str * The <code>String</code> to escape. * @return A new escaped <code>String</code>. */ public String unescape(String str) { int firstAmp = str.indexOf('&'); if (firstAmp < 0) { return str; } else { StringBuilder sb = createStringBuilder(str); doUnescape(sb, str, firstAmp); return sb.toString(); } }