Util.java revision 345
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* See LICENSE.txt included in this distribution for the specific
* language governing permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at LICENSE.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/**
* File for useful functions
*/
public class Util {
/**
* 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
*/
throws IOException {
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)
*/
try {
} catch (IOException ioe) {
// StringBuilder's append methods are not declared to throw
// IOException, so this should never happen.
}
}
throws IOException {
}
}
/**
* 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
*/
switch (c) {
case '&':
break;
case '>':
break;
case '<':
break;
case '\n':
break;
default:
}
}
}
return l;
}
}
int s = 0,
e = 0;
if (e - s > 0) {
}
s = e + 1;
}
if (s < l.length()) {
}
}
float l = (float) num;
if (l < 1024) {
} else if (l < 1048576) {
} else {
}
}
throws IOException {
if (num > 1) {
}
if (annotation != null) {
}
if (enabled) {
}
if (enabled) {
}
}
} else {
}
}
}
/**
* 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.
*/
}
}
try {
// 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.
} catch (UnsupportedEncodingException e) {
// Should not happen. ISO-8859-1 must be supported by all JVMs.
return null;
}
}
try {
return uri.getRawPath();
} catch (URISyntaxException ex) {
return "";
}
}
if (q == null) {
return "";
}
char c;
for (int i = 0; i < q.length(); i++) {
c = q.charAt(i);
if (c == '"') {
} else {
}
}
}
/**
* 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
* they are unused.
*
* @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.
*/
public static String buildQueryString(String freetext, String defs, String refs, String path, String hist) {
}
}
}
}
}
}
}