Util.java revision 292
98N/A * CDDL HEADER START 98N/A * The contents of this file are subject to the terms of the 98N/A * Common Development and Distribution License (the "License"). 98N/A * You may not use this file except in compliance with the License. 98N/A * language governing permissions and limitations under the License. 98N/A * When distributing Covered Code, include this CDDL HEADER in each 98N/A * If applicable, add the following below this CDDL HEADER, with the 98N/A * fields enclosed by brackets "[]" replaced with your own identifying 98N/A * information: Portions Copyright [yyyy] [name of copyright owner] 98N/A * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 98N/A * Use is subject to license terms. 98N/A * File for useful functions * Return a string which represents a <code>CharSequence</code> in HTML. * @param q a character sequence * @return a string representing the character sequence in HTML * Append a character sequence to an <code>Appendable</code> object. Escape * special characters for HTML. * @param q a character sequence * @param out the object to append the character sequence to * @exception IOException if an I/O error occurs for (
int i =
0; i < q.
length(); i++) {
* Append a character sequence to a <code>StringBuilder</code> * object. Escape special characters for HTML. This method is identical to * <code>Htmlize(CharSequence,Appendable)</code>, except that it is * guaranteed not to throw <code>IOException</code> because it uses a * <code>StringBuilder</code>. * @param q a character sequence * @param out the object to append the character sequence to * @see #Htmlize(CharSequence, Appendable) // StringBuilder's append methods are not declared to throw // IOException, so this should never happen. * Append a character to a an <code>Appendable</code> object. If the * character has special meaning in HTML, append a sequence of characters * representing the special character. * @param c the character to append * @param out the object to append the character to * @exception IOException if an I/O error occurs }
else if (l <
1048576) {
out.
write(
"<span class=\"blame\"><span class=\"l\"> ");
* Append path and date into a string in such a way that lexicographic * sorting gives the same results as a walk of the file hierarchy. Thus * null (\u0000) is used both to separate directory components and to * separate the path from the date. // We should probably use an encoding which supports a larger // character set, but use ISO-8859-1 for now, since that's what // we use other places in the code. // Should not happen. ISO-8859-1 must be supported by all JVMs. for (
int i =
0; i < q.
length(); i++) {
* Build a string that may be converted to a Query and passed to Lucene. * All parameters may be passed as null or an empty string to indicate that * @param freetext The string from the "Full Search" text-field. This field * will be applied as it is specified. * @param defs The string from the "Definition" text-field. This field * will be searched for in the <b>defs</b> field in the lucene * index. All occurences of ":" will be replaced with "\:" * @param refs The string from the "Symbol" text-field. This field * will be searched for in the <b>refs</b> field in the lucene * index. All occurences of ":" will be replaced with "\:" * @param path The string from the "File Path" text-field. This field * will be searched for in the <b>path</b> field in the lucene * index. All occurences of ":" will be replaced with "\:" * @param hist The string from the "History" text-field. This field * will be searched for in the <b>hist</b> field in the lucene * index. All occurences of ":" will be replaced with "\:" * @return A string to be parsed by the Lucene parser.