Great set of javadoc improvements from Fredrik.

Also an optimisation to StringUtils.leftPad/rightPad.
Submitted by: Fredrik Westermarck


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137402 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2003-07-08 05:59:58 +00:00
parent b78e65b2c4
commit 5c3606e55e
6 changed files with 375 additions and 321 deletions

View File

@ -65,7 +65,7 @@
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
* @author Phil Steitz
* @since 1.0
* @version $Id: RandomStringUtils.java,v 1.13 2003/06/09 21:36:02 scolebourne Exp $
* @version $Id: RandomStringUtils.java,v 1.14 2003/07/08 05:59:58 bayard Exp $
*/
public class RandomStringUtils {
@ -198,10 +198,10 @@ public static String random(int count, int start, int end, boolean letters, bool
* <p>Creates a random string based on a variety of options, using
* default source of randomness.</p>
*
* This method has exactly the same semantics as {@link
* <p>This method has exactly the same semantics as {@link
* #random(int,int,int,boolean,boolean,char[],Random)}, but
* instead of using an externally supplied source of randomness, it uses
* the internal static {@link Random} instance ({@link #RANDOM}).
* the internal static {@link Random} instance ({@link #RANDOM}).</p>
*
* @param count length of random string to create
* @param start position in set of chars to start at

View File

@ -55,8 +55,6 @@
import java.io.IOException;
import java.io.Writer;
import java.io.PrintWriter;
import org.apache.commons.lang.exception.NestableRuntimeException;
/**
@ -75,7 +73,7 @@
* @author <a href="sean@boohai.com">Sean Brown</a>
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
* @since 2.0
* @version $Id: StringEscapeUtils.java,v 1.15 2003/07/05 23:37:30 alex Exp $
* @version $Id: StringEscapeUtils.java,v 1.16 2003/07/08 05:59:58 bayard Exp $
*/
public class StringEscapeUtils {
@ -86,9 +84,10 @@ public class StringEscapeUtils {
/**
* <p><code>StringEscapeUtils</code> instances should NOT be constructed in
* standard programming.</p>
* <p>Instead, the class should be used as:</p>
* <pre>StringEscapeUtils.escapeJava("foo");</pre>
* standard programming.</p>
*
* <p>Instead, the class should be used as:
* <pre>StringEscapeUtils.escapeJava("foo");</pre></p>
*
* <p>This constructor is public to permit tools that require a JavaBean
* instance to operate.</p>
@ -100,6 +99,7 @@ public StringEscapeUtils() {
//--------------------------------------------------------------------------
/**
* <p>Escapes the characters in a <code>String</code> using Java String rules.</p>
*
* <p>Deals correctly with quotes and control-chars (tab, backslash, cr, ff, etc.) </p>
*
* <p>So a tab becomes the characters <code>'\\'</code> and
@ -124,7 +124,8 @@ public static String escapeJava(String str) {
}
/**
* <p>Escapes the characters in a <code>String</code> using Java String rules to a <code>Writer</code>.</p>
* <p>Escapes the characters in a <code>String</code> using Java String rules to
* a <code>Writer</code>.</p>
*
* @see #escapeJava(java.lang.String)
* @param out Writer to write escaped string into
@ -163,7 +164,8 @@ public static String escapeJavaScript(String str) {
}
/**
* <p>Escapes the characters in a <code>String</code> using JavaScript String rules to a <code>Writer</code>.</p>
* <p>Escapes the characters in a <code>String</code> using JavaScript String rules
* to a <code>Writer</code>.</p>
*
* @see #escapeJavaScript(java.lang.String)
* @param out Writer to write escaped string into
@ -253,7 +255,8 @@ private static void escapeJavaStyleString(Writer out, String str, boolean escape
}
/**
* Returns an upper case hexadecimal <code>String</code> for the given character.
* <p>Returns an upper case hexadecimal <code>String</code> for the given
* character.</p>
*
* @param ch The character to convert.
* @return An upper case hexadecimal <code>String</code>
@ -263,9 +266,10 @@ private static String hex(char ch) {
}
/**
* Unescapes any Java literals found in the <code>String</code>.
* For example, it will turn a sequence of '\' and 'n' into a newline character,
* unless the '\' is preceded by another '\'.
* <p>Unescapes any Java literals found in the <code>String</code>.
* For example, it will turn a sequence of <code>'\'</code> and
* <code>'n'</code> into a newline character, unless the <code>'\'</code>
* is preceded by another <code>'\'</code>.</p>
*
* @param str The <code>String</code> to unescape.
* @return A new unescaped <code>String</code>.
@ -283,9 +287,12 @@ public static String unescapeJava(String str) {
}
/**
* Unescapes any Java literals found in the <code>String</code> to a <code>Writer</code>.
* For example, it will turn a sequence of '\' and 'n' into a newline character,
* unless the '\' is preceded by another '\'.
* <p>Unescapes any Java literals found in the <code>String</code> to a
* <code>Writer</code>.</p>
*
* <p>For example, it will turn a sequence of <code>'\'</code> and
* <code>'n'</code> into a newline character, unless the <code>'\'</code>
* is preceded by another <code>'\'</code>.</p>
*
* @param out The <code>Writer</code> used to output unescaped characters.
* @param str The <code>String</code> to unescape.
@ -369,9 +376,11 @@ public static void unescapeJava(Writer out, String str) throws IOException {
}
/**
* Unescapes any JavaScript literals found in the <code>String</code>.
* For example, it will turn a sequence of '\' and 'n' into a newline character,
* unless the '\' is preceded by another '\'.
* <p>Unescapes any JavaScript literals found in the <code>String</code>.</p>
*
* <p>For example, it will turn a sequence of <code>'\'</code> and <code>'n'</code>
* into a newline character, unless the <code>'\'</code> is preceded by another
* <code>'\'</code>.</p>
*
* @param str The <code>String</code> to unescape.
* @return A new unescaped <code>String</code>.
@ -382,9 +391,12 @@ public static String unescapeJavaScript(String str) {
}
/**
* Unescapes any JavaScript literals found in the <code>String</code> to a <code>Writer</code>.
* For example, it will turn a sequence of '\' and 'n' into a newline character,
* unless the '\' is preceded by another '\'.
* <p>Unescapes any JavaScript literals found in the <code>String</code> to a
* <code>Writer</code>.</p>
*
* <p>For example, it will turn a sequence of <code>'\'</code> and <code>'n'</code>
* into a newline character, unless the <code>'\'</code> is preceded by another
* <code>'\'</code>.</p>
*
* @param out The <code>Writer</code> used to output unescaped characters.
* @param str The <code>String</code> to unescape.
@ -400,11 +412,12 @@ public static void unescapeJavaScript(Writer out, String str) throws IOException
/**
* <p>Escapes the characters in a <code>String</code> using HTML entities.</p>
*
* <p>
* For example: <tt>"bread" & "butter"</tt> => <tt>&amp;quot;bread&amp;quot; &amp;amp; &amp;quot;butter&amp;quot;</tt>.
* </p>
* <p>Supports all known HTML 4.0 entities, including funky accents.
* </p>
*
* <p>Supports all known HTML 4.0 entities, including funky accents.</p>
*
* @param str The <code>String</code> to escape
* @return A new escaped <code>String</code>.
@ -427,8 +440,10 @@ public static String escapeHtml(String str) {
* <p>Unescapes a string containing entity escapes to a string
* containing the actual Unicode characters corresponding to the
* escapes. Supports HTML 4.0 entities.</p>
*
* <p>For example, the string "&amp;lt;Fran&amp;ccedil;ais&amp;gt;"
* will become "&lt;Fran&ccedil;ais&gt;"</p>
*
* <p>If an entity is unrecognized, it is left alone, and inserted
* verbatim into the result string. e.g. "&amp;gt;&amp;zzzz;x" will
* become "&gt;&amp;zzzz;x".</p>
@ -443,14 +458,14 @@ public static String unescapeHtml(String str) {
/**
* <p>Escapes the characters in a <code>String</code> using XML entities.</p>
* <p>
* For example: <tt>"bread" & "butter"</tt> =>
*
* <p>For example: <tt>"bread" & "butter"</tt> =>
* <tt>&amp;quot;bread&amp;quot; &amp;amp; &amp;quot;butter&amp;quot;</tt>.
* </p>
* <p>
* Supports only the four basic XML entities (gt, lt, quot, amp).
* Does not support DTDs or external entities.
* </p>
*
* <p>Supports only the four basic XML entities (gt, lt, quot, amp).
* Does not support DTDs or external entities.</p>
*
* @param str The <code>String</code> to escape
* @return A new escaped <code>String</code>.
* @see #unescapeXml(java.lang.String)
@ -462,12 +477,10 @@ public static String escapeXml(String str) {
/**
* <p>Unescapes a string containing XML entity escapes to a string
* containing the actual Unicode characters corresponding to the
* escapes.
* </p>
* <p>
* Supports only the four basic XML entities (gt, lt, quot, amp).
* Does not support DTDs or external entities.
* </p>
* escapes.</p>
*
* <p>Supports only the four basic XML entities (gt, lt, quot, amp).
* Does not support DTDs or external entities.</p>
*
* @param str The <code>String</code> to unescape
* @return A new unescaped <code>String</code>.
@ -478,13 +491,19 @@ public static String unescapeXml(String str) {
}
/**
* Escapes the characters in a <code>String</code> to be suitable to pass to
* an SQL query. For example,
* <p>Escapes the characters in a <code>String</code> to be suitable to pass to
* an SQL query.</p>
*
* <p>For example,
* <pre>statement.executeQuery("SELECT * FROM MOVIES WHERE TITLE='" +
* StringEscapeUtils.escapeSql("McHale's Navy") +
* "'");</pre>
* At present, this method only turns single-quotes into doubled single-quotes (<code>"McHale's Navy"</code> => <code>"McHale''s Navy"</code>).
* It does not handle the cases of percent (%) or underscore (_) for use in LIKE clauses.
* </p>
*
* <p>At present, this method only turns single-quotes into doubled single-quotes
* (<code>"McHale's Navy"</code> => <code>"McHale''s Navy"</code>). It does not
* handle the cases of percent (%) or underscore (_) for use in LIKE clauses.</p>
*
* see http://www.jguru.com/faq/view.jsp?EID=8881
* @param s the string to escape
* @return A new String, escaped for SQL

View File

@ -56,12 +56,16 @@
import java.io.*;
/**
* A PrintWriter that maintains a String as its backing store.
* Usage: <pre>
* <p>A PrintWriter that maintains a String as its backing store.</p>
*
* <p>Usage:
* <pre>
* StringPrintWriter out = new StringPrintWriter();
* printTo(out);
* System.out.println( out.getString() );
* </pre>
* </p>
*
* @author Alex Chaffee
* @author Scott Stanchfield
**/
@ -75,9 +79,10 @@ public StringPrintWriter(int initialSize) {
}
/**
* Since toString() returns information *about* this object, we
* <p>Since toString() returns information *about* this object, we
* want a separate method to extract just the contents of the
* internal buffer as a String.
* internal buffer as a String.</p>
*
* @return the contents of the internal string buffer
*/
public String getString() {

View File

@ -79,7 +79,7 @@
* @author Arun Mammen Thomas
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
* @since 1.0
* @version $Id: StringUtils.java,v 1.51 2003/06/24 21:14:50 scolebourne Exp $
* @version $Id: StringUtils.java,v 1.52 2003/07/08 05:59:58 bayard Exp $
*/
public class StringUtils {
@ -98,7 +98,7 @@ public class StringUtils {
/**
* <p>An array of <code>String</code>s used for padding.</p>
*
* <p>Used for efficient blank padding. The length of each string expands as needed.</p>
* <p>Used for efficient blank padding. The length of each string expands as needed.</p>
*/
private final static String[] padding = new String[Character.MAX_VALUE];
// String.concat about twice as fast as StringBuffer.append
@ -845,11 +845,12 @@ public static String center(String str, int size, String delim) {
/**
* <p>Remove one newline from end of a String if it's there,
* otherwise leave it alone. A newline is "\n", "\r", or "\r\n".
* <p>
* Note that this behavior has changed from 1.0. It
* otherwise leave it alone. A newline is &quot;<code>\n</code>&quot;,
* &quot;<code>\r</code>&quot;, or &quot;<code>\r\n</code>&quot;.</p>
*
* <p>Note that this behavior has changed from 1.0. It
* now more closely matches Perl chomp. For the previous behavior,
* use slice(String).
* use {@link #slice(String)}.</p>
*
* @param str String to chomp a newline from
* @return String without newline
@ -885,13 +886,12 @@ public static String chomp(String str) {
}
/**
* <p>Remove one string (the separator) from the end of another
* string if it's there, otherwise leave it alone.
* <p>
* <p>Remove <code>separator</code> from the end of
* <code>str</code> if it's there, otherwise leave it alone.</p>
*
* Note that this behavior has changed from 1.0. It
* <p>Note that this behavior has changed from 1.0. It
* now more closely matches Perl chomp. For the previous behavior,
* use {@link #slice(String,String)}.
* use {@link #slice(String,String)}.</p>
*
* @param str string to chomp from
* @param separator separator string
@ -909,7 +909,7 @@ public static String chomp(String str, String separator) {
}
/**
* <p>Remove a newline if and only if it is at the end
* <p>Remove any &quot;\n&quot; if and only if it is at the end
* of the supplied String.</p>
*
* @param str String to chomp from
@ -1070,7 +1070,8 @@ public static String chopNewline(String str) {
/**
* <p>Remove the last newline, and everything after it from a String.</p>
* (This method was formerly named chomp or chopNewline.)
*
* <p><em>(This method was formerly named chomp or chopNewline.)</em></p>
*
* @param str String to slice the newline from
* @return String without sliced newline
@ -1083,7 +1084,8 @@ public static String slice(String str) {
/**
* <p>Find the last occurence of a separator String;
* remove it and everything after it.</p>
* (This method was formerly named chomp.)
*
* <p><em>(This method was formerly named chomp.)</em></p>
*
* @param str String to slice from
* @param sep String to slice
@ -1102,8 +1104,9 @@ public static String slice(String str, String sep) {
/**
* <p>Find the last occurence of a separator String, and return
* everything after it.</p>
* (This method was formerly named getchomp. Also, now it does not
* include the separator in the return value.)
*
* <p><em>(This method was formerly named getchomp. Also, now it does not
* include the separator in the return value.)</em></p>
*
* @param str String to slice from
* @param sep String to slice
@ -1124,8 +1127,9 @@ public static String sliceRemainder(String str, String sep) {
/**
* <p>Find the first occurence of a separator String, and return
* everything after it.</p>
* (This method was formerly named prechomp. Also, previously
* it included the separator in the return value; now it does not.)
*
* <p><em>(This method was formerly named prechomp. Also, previously
* it included the separator in the return value; now it does not.)</em></p>
*
* @param str String to slice from
* @param sep String to slice
@ -1144,8 +1148,9 @@ public static String sliceFirstRemainder(String str, String sep) {
/**
* <p>Find the first occurence of a separator string;
* return everything before it (but not including the separator).</p>
* (This method was formerly named getPrechomp. Also, it used to
* include the separator, but now it does not.)
*
* <p><em>(This method was formerly named getPrechomp. Also, it used to
* include the separator, but now it does not.)</em></p>
*
* @param str String to slice from
* @param sep String to slice
@ -1185,13 +1190,14 @@ public static String escape(String str) {
}
/**
* Unescapes any Java literals found in the String. For example,
* it will turn a sequence of '\' and 'n' into a newline character,
* unless the '\' is preceded by another '\'.
* <p>
* As of Lang 2.0, this calls {@link StringEscapeUtils#unescapeJava(java.lang.String)}
* behind the scenes.
* <p>
* <p>Unescapes any Java literals found in the String. For example,
* it will turn a sequence of <code>'\'</code> and <code>'n'</code>
* into a newline character, unless the <code>'\'</code> is preceded
* by another <code>'\'</code>.</p>
*
* <p>As of Lang 2.0, this calls {@link StringEscapeUtils#unescapeJava(java.lang.String)}
* behind the scenes.</p>
*
* @see StringEscapeUtils#unescapeJava(java.lang.String)
* @deprecated Use {@link StringEscapeUtils#unescapeJava(java.lang.String)}
* This method will be removed in Commons Lang 3.0
@ -1240,8 +1246,8 @@ private static String padding(int repeat) {
}
/**
* <p>Returns padding using the specified delimiter repeated to a given length.
* </p>
* <p>Returns padding using the specified delimiter repeated
* to a given length.</p>
*
* @param repeat number of times to repeat delim
* @param delim character to repeat
@ -1276,7 +1282,7 @@ public static String rightPad(String str, int size) {
return str; // returns original string when possible
}
if (pads > PAD_LIMIT) {
return rightPad(str, size, " ");
return rightPad(str, size, ' ');
}
return str + padding(pads);
}
@ -1343,13 +1349,15 @@ public static String leftPad(String str, int size) {
return str; // returns original string when possible
}
if (pads > PAD_LIMIT) {
return leftPad(str, size, " ");
return leftPad(str, size, ' ');
}
return padding(pads).concat(str);
}
/**
* Left pad a String with a specified character. Pad to a size of n.
* <p>Left pad a String with a specified character.</p>
*
* <p>Pad to a size of <code>n</code>.</p>
*
* @param str String to pad out
* @param size size to pad to
@ -1363,13 +1371,15 @@ public static String leftPad(String str, int size, char delim) {
return str; // returns original string when possible
}
if (pads > PAD_LIMIT) {
return leftPad(str, size, " ");
return leftPad(str, size, ' ');
}
return padding(pads, delim).concat(str);
}
/**
* Left pad a String with a specified string. Pad to a size of n.
* <p>Left pad a String with a specified string.</p>
*
* <p>Pad to a size of <code>n</code>.</p>
*
* @param str String to pad out
* @param size size to pad to
@ -2145,14 +2155,19 @@ public static String reverseDelimitedString(String str, String delimiter) {
//--------------------------------------------------------------------------
/**
* Turn "Now is the time for all good men" into "Now is the time for..."
* <p>
* Specifically:
* <p>
* If str is less than max characters long, return it.
* Else abbreviate it to (substring(str, 0, max-3) + "...").
* If maxWidth is less than 3, throw an IllegalArgumentException.
* In no case will it return a string of length greater than maxWidth.
* <p>Turn "Now is the time for all good men" into "Now is the time for..."</p>
*
* <p>Specifically:
* <ul>
* <li>If <code>str</code> is less than <code>maxWidth</code> characters
* long, return it.</li>
* <li>Else abbreviate it to <code>(substring(str, 0, max-3) + "...")</code>.</li>
* <li>If <code>maxWidth</code> is less than </code>3, throw an
* <code>IllegalArgumentException</code>.</li>
* <li>In no case will it return a string of length greater than
* <code>maxWidth</code>.</li>
* </ul>
* </p>
*
* @param maxWidth maximum length of result string
*/
@ -2161,13 +2176,15 @@ public static String abbreviate(String s, int maxWidth) {
}
/**
* Turn "Now is the time for all good men" into "...is the time for..."
* <p>
* Works like abbreviate(String, int), but allows you to specify a "left edge"
* offset. Note that this left edge is not necessarily going to be the leftmost
* character in the result, or the first
* character following the ellipses, but it will appear somewhere in the result.
* In no case will it return a string of length greater than maxWidth.
* <p>Turn "Now is the time for all good men" into "...is the time for..."</p>
*
* <p>Works like <code>abbreviate(String, int)</code>, but allows you to specify
* a "left edge" offset. Note that this left edge is not necessarily going to
* be the leftmost character in the result, or the first character following the
* ellipses, but it will appear somewhere in the result.
*
* <p>In no case will it return a string of length greater than
* <code>maxWidth</code>.</p>
*
* @param offset left edge of source string
* @param maxWidth maximum length of result string
@ -2194,9 +2211,10 @@ public static String abbreviate(String s, int offset, int maxWidth) {
//--------------------------------------------------------------------------
/**
* Compare two strings, and return the portion where they differ.
* <p>Compare two strings, and return the portion where they differ.
* (More precisely, return the remainder of the second string,
* starting from where it's different from the first.)
* starting from where it's different from the first.)</p>
*
* <p>
* For example, <code>difference("i am a machine", "i am a robot") -> "robot"</code>
*

View File

@ -67,13 +67,13 @@
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
* @author Michael Becke
* @since 1.0
* @version $Id: SystemUtils.java,v 1.16 2003/06/08 14:10:54 scolebourne Exp $
* @version $Id: SystemUtils.java,v 1.17 2003/07/08 05:59:58 bayard Exp $
*/
public class SystemUtils {
//-----------------------------------------------------------------------
/**
* The <code>file.encoding</code> System Property.
* <p>The <code>file.encoding</code> System Property.</p>
* <p>File encoding, such as <code>Cp1252</code>.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
@ -84,10 +84,10 @@ public class SystemUtils {
public static final String FILE_ENCODING = getSystemProperty("file.encoding");
/**
* The <code>file.separator</code> System Property.
* File separator ("/" on UNIX).
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>file.separator</code> System Property.
* File separator (<code>&quot;/&quot;</code> on UNIX).</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java version 1.1.
@ -96,101 +96,115 @@ public class SystemUtils {
//-----------------------------------------------------------------------
/**
* Is <code>true</code> if this is Java version 1.1 (also 1.1.x versions).
* <p>
* The field will return false if {@link #JAVA_VERSION} is <code>null</code>.</p>
* <p>Is <code>true</code> if this is Java version 1.1 (also 1.1.x versions).</p>
*
* <p>The field will return <code>false</code> if {@link #JAVA_VERSION} is
* <code>null</code>.</p>
*/
public static final boolean IS_JAVA_1_1 = getJavaVersionMatches("1.1");
/**
* Is <code>true</code> if this is Java version 1.2 (also 1.2.x versions).
* <p>
* The field will return false if {@link #JAVA_VERSION} is <code>null</code>.</p>
* <p>Is <code>true</code> if this is Java version 1.2 (also 1.2.x versions).</p>
*
* <p>The field will return <code>false</code> if {@link #JAVA_VERSION} is
* <code>null</code>.</p>
*/
public static final boolean IS_JAVA_1_2 = getJavaVersionMatches("1.2");
/**
* Is <code>true</code> if this is Java version 1.3 (also 1.3.x versions).
* <p>
* The field will return false if {@link #JAVA_VERSION} is <code>null</code>.</p>
* <p>Is <code>true</code> if this is Java version 1.3 (also 1.3.x versions).</p>
*
* <p>The field will return <code>false</code> if {@link #JAVA_VERSION} is
* <code>null</code>.</p>
*/
public static final boolean IS_JAVA_1_3 = getJavaVersionMatches("1.3");
/**
* Is <code>true</code> if this is Java version 1.4 (also 1.4.x versions).
* <p>
* The field will return false if {@link #JAVA_VERSION} is <code>null</code>.</p>
* <p>Is <code>true</code> if this is Java version 1.4 (also 1.4.x versions).</p>
*
* <p>The field will <code>false</code> false if {@link #JAVA_VERSION} is
* <code>null</code>.</p>
*/
public static final boolean IS_JAVA_1_4 = getJavaVersionMatches("1.4");
/**
* Is <code>true</code> if this is Java version 1.5 (also 1.5.x versions).
* <p>
* The field will return false if {@link #JAVA_VERSION} is <code>null</code>.</p>
* <p>Is <code>true</code> if this is Java version 1.5 (also 1.5.x versions).</p>
*
* <p>The field will return <code>false</code> if {@link #JAVA_VERSION} is
* <code>null</code>.</p>
*/
public static final boolean IS_JAVA_1_5 = getJavaVersionMatches("1.5");
/**
* Is <code>true</code> if this is AIX.
* <p>
* The field will return false if <code>OS_NAME</code> is <code>null</code>.</p>
* <p>Is <code>true</code> if this is AIX.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*/
public static final boolean IS_OS_AIX = getOSMatches("AIX");
/**
* Is <code>true</code> if this is HP-UX.
* <p>
* The field will return false if <code>OS_NAME</code> is <code>null</code>.</p>
* <p>Is <code>true</code> if this is HP-UX.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*/
public static final boolean IS_OS_HP_UX = getOSMatches("HP-UX");
/**
* Is <code>true</code> if this is Irix.
* <p>
* The field will return false if <code>OS_NAME</code> is <code>null</code>.</p>
* <p>Is <code>true</code> if this is Irix.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*/
public static final boolean IS_OS_IRIX = getOSMatches("Irix");
/**
* Is <code>true</code> if this is Linux.
* <p>
* The field will return false if <code>OS_NAME</code> is <code>null</code>.</p>
* <p>Is <code>true</code> if this is Linux.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*/
public static final boolean IS_OS_LINUX = getOSMatches("Linux") || getOSMatches("LINUX");
// Windows XP returns 'Windows 2000' just for fun...
/**
* Is <code>true</code> if this is Mac.
* <p>
* The field will return false if <code>OS_NAME</code> is <code>null</code>.</p>
* <p>Is <code>true</code> if this is Mac.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*/
public static final boolean IS_OS_MAC = getOSMatches("Mac");
/**
* Is <code>true</code> if this is Mac.
* <p>
* The field will return false if <code>OS_NAME</code> is <code>null</code>.</p>
* <p>Is <code>true</code> if this is Mac.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*/
public static final boolean IS_OS_MAC_OSX = getOSMatches("Mac OS X");
/**
* Is <code>true</code> if this is Mac.
* <p>
* The field will return false if <code>OS_NAME</code> is <code>null</code>.</p>
* <p>Is <code>true</code> if this is Mac.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*/
public static final boolean IS_OS_OS2 = getOSMatches("OS/2");
/**
* Is <code>true</code> if this is Solaris.
* <p>
* The field will return false if <code>OS_NAME</code> is <code>null</code>.</p>
* <p>Is <code>true</code> if this is Solaris.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*/
public static final boolean IS_OS_SOLARIS = getOSMatches("Solaris");
/**
* Is <code>true</code> if this is SunOS.
* <p>
* The field will return false if <code>OS_NAME</code> is <code>null</code>.</p>
* <p>Is <code>true</code> if this is SunOS.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*/
public static final boolean IS_OS_SUN_OS = getOSMatches("SunOS");
@ -200,63 +214,69 @@ public class SystemUtils {
// if you want another added or a mistake corrected
/**
* Is <code>true</code> if this is Windows.
* <p>
* The field will return false if <code>OS_NAME</code> is <code>null</code>.</p>
* <p>Is <code>true</code> if this is Windows.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*/
public static final boolean IS_OS_WINDOWS = getOSMatches("Windows");
/**
* Is <code>true</code> if this is Windows 2000.
* <p>
* The field will return false if <code>OS_NAME</code> is <code>null</code>.</p>
* <p>Is <code>true</code> if this is Windows 2000.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*/
public static final boolean IS_OS_WINDOWS_2000 = getOSMatches("Windows", "5.0");
/**
* Is <code>true</code> if this is Windows 95.
* <p>
* The field will return false if <code>OS_NAME</code> is <code>null</code>.</p>
* <p>Is <code>true</code> if this is Windows 95.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*/
public static final boolean IS_OS_WINDOWS_95 = getOSMatches("Windows 9", "4.0");
// JDK 1.2 running on Windows98 returns 'Windows 95', hence the above
/**
* Is <code>true</code> if this is Windows 98.
* <p>
* The field will return false if <code>OS_NAME</code> is <code>null</code>.</p>
* <p>Is <code>true</code> if this is Windows 98.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*/
public static final boolean IS_OS_WINDOWS_98 = getOSMatches("Windows 9", "4.1");
// JDK 1.2 running on Windows98 returns 'Windows 95', hence the above
/**
* Is <code>true</code> if this is Windows ME.
* <p>
* The field will return false if <code>OS_NAME</code> is <code>null</code>.</p>
* <p>Is <code>true</code> if this is Windows ME.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*/
public static final boolean IS_OS_WINDOWS_ME = getOSMatches("Windows", "4.9");
// JDK 1.2 running on WindowsME may return 'Windows 95', hence the above
/**
* Is <code>true</code> if this is Windows NT.
* <p>
* The field will return false if <code>OS_NAME</code> is <code>null</code>.</p>
* <p>Is <code>true</code> if this is Windows NT.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*/
public static final boolean IS_OS_WINDOWS_NT = getOSMatches("Windows NT");
// Windows 2000 returns 'Windows 2000' but may suffer from same JDK1.2 problem
/**
* Is <code>true</code> if this is Windows XP.
* <p>
* The field will return false if <code>OS_NAME</code> is <code>null</code>.</p>
* <p>Is <code>true</code> if this is Windows XP.</p>
*
* <p>The field will return <code>false</code> if <code>OS_NAME</code> is
* <code>null</code>.</p>
*/
public static final boolean IS_OS_WINDOWS_XP = getOSMatches("Windows", "5.1");
/**
* The <code>java.class.path</code> System Property.
* Java class path.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.class.path</code> System Property. Java class path.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java version 1.1.
@ -264,10 +284,10 @@ public class SystemUtils {
public static final String JAVA_CLASS_PATH = getSystemProperty("java.class.path");
/**
* The <code>java.class.version</code> System Property.
* Java class format version number.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.class.version</code> System Property.
* Java class format version number.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java version 1.1.
@ -275,11 +295,10 @@ public class SystemUtils {
public static final String JAVA_CLASS_VERSION = getSystemProperty("java.class.version");
/**
* The <code>java.compiler</code> System Property.
* Name of JIT compiler to use.
* First in JDK version 1.2. Not used in Sun JDKs after 1.2.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.compiler</code> System Property. Name of JIT compiler to use.
* First in JDK version 1.2. Not used in Sun JDKs after 1.2.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java version 1.2. Not used in Sun versions after 1.2.
@ -287,10 +306,10 @@ public class SystemUtils {
public static final String JAVA_COMPILER = getSystemProperty("java.compiler");
/**
* The <code>java.ext.dirs</code> System Property.
* Path of extension directory or directories.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.ext.dirs</code> System Property. Path of extension directory
* or directories.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.3
@ -298,10 +317,9 @@ public class SystemUtils {
public static final String JAVA_EXT_DIRS = getSystemProperty("java.ext.dirs");
/**
* The <code>java.home</code> System Property.
* Java installation directory.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.home</code> System Property. Java installation directory.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.1
@ -309,10 +327,9 @@ public class SystemUtils {
public static final String JAVA_HOME = getSystemProperty("java.home");
/**
* The <code>java.io.tmpdir</code> System Property.
* Default temp file path.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.io.tmpdir</code> System Property. Default temp file path.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.2
@ -320,10 +337,10 @@ public class SystemUtils {
public static final String JAVA_IO_TMPDIR = getSystemProperty("java.io.tmpdir");
/**
* The <code>java.library.path</code> System Property.
* List of paths to search when loading libraries.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.library.path</code> System Property. List of paths to search
* when loading libraries.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.2
@ -331,10 +348,10 @@ public class SystemUtils {
public static final String JAVA_LIBRARY_PATH = getSystemProperty("java.library.path");
/**
* The <code>java.runtime.name</code> System Property.
* Java Runtime Environment name.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.runtime.name</code> System Property. Java Runtime Environment
* name.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.3
@ -342,10 +359,10 @@ public class SystemUtils {
public static final String JAVA_RUNTIME_NAME = getSystemProperty("java.runtime.name");
/**
* The <code>java.runtime.version</code> System Property.
* Java Runtime Environment version.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.runtime.version</code> System Property. Java Runtime Environment
* version.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.3
@ -353,10 +370,10 @@ public class SystemUtils {
public static final String JAVA_RUNTIME_VERSION = getSystemProperty("java.runtime.version");
/**
* The <code>java.specification.name</code> System Property.
* Java Runtime Environment specification name.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.specification.name</code> System Property. Java Runtime Environment
* specification name.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.2
@ -364,10 +381,10 @@ public class SystemUtils {
public static final String JAVA_SPECIFICATION_NAME = getSystemProperty("java.specification.name");
/**
* The <code>java.specification.vendor</code> System Property.
* Java Runtime Environment specification vendor.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.specification.vendor</code> System Property. Java Runtime Environment
* specification vendor.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.2
@ -375,10 +392,10 @@ public class SystemUtils {
public static final String JAVA_SPECIFICATION_VENDOR = getSystemProperty("java.specification.vendor");
/**
* The <code>java.specification.version</code> System Property.
* Java Runtime Environment specification version.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.specification.version</code> System Property. Java Runtime Environment
* specification version.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.3
@ -386,10 +403,9 @@ public class SystemUtils {
public static final String JAVA_SPECIFICATION_VERSION = getSystemProperty("java.specification.version");
/**
* The <code>java.vendor</code> System Property.
* Java vendor-specific string.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.vendor</code> System Property. Java vendor-specific string.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.1
@ -397,10 +413,9 @@ public class SystemUtils {
public static final String JAVA_VENDOR = getSystemProperty("java.vendor");
/**
* The <code>java.vendor.url</code> System Property.
* Java vendor URL.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.vendor.url</code> System Property. Java vendor URL.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.1
@ -408,10 +423,9 @@ public class SystemUtils {
public static final String JAVA_VENDOR_URL = getSystemProperty("java.vendor.url");
/**
* The <code>java.version</code> System Property.
* Java version number.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.version</code> System Property. Java version number.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.1
@ -420,34 +434,36 @@ public class SystemUtils {
//-----------------------------------------------------------------------
/**
* Gets the Java version as a <code>float</code>.
* <p>Gets the Java version as a <code>float</code>.</p>
*
* <p>Example return values:</p>
* <ul>
* <li><code>1.2f</code> for JDK 1.2
* <li><code>1.31f</code> for JDK 1.3.1
* </ul>
* <p>
* The field will return zero if {@link #JAVA_VERSION} is <code>null</code>.</p>
*
* <p>The field will return zero if {@link #JAVA_VERSION} is <code>null</code>.</p>
*/
public static final float JAVA_VERSION_FLOAT = getJavaVersionAsFloat();
/**
* Gets the Java version as an <code>int</code>.
* <p>Gets the Java version as an <code>int</code>.</p>
*
* <p>Example return values:</p>
* <ul>
* <li><code>120</code> for JDK 1.2
* <li><code>131</code> for JDK 1.3.1
* </ul>
* <p>
* The field will return zero if {@link #JAVA_VERSION} is <code>null</code>.</p>
*
* <p>The field will return zero if {@link #JAVA_VERSION} is <code>null</code>.</p>
*/
public static final int JAVA_VERSION_INT = getJavaVersionAsInt();
/**
* The <code>java.vm.info</code> System Property.
* Java Virtual Machine implementation info.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.vm.info</code> System Property. Java Virtual Machine implementation
* info.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.2
@ -455,10 +471,10 @@ public class SystemUtils {
public static final String JAVA_VM_INFO = getSystemProperty("java.vm.info");
/**
* The <code>java.vm.name</code> System Property.
* Java Virtual Machine implementation name.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.vm.name</code> System Property. Java Virtual Machine implementation
* name.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.2
@ -466,10 +482,10 @@ public class SystemUtils {
public static final String JAVA_VM_NAME = getSystemProperty("java.vm.name");
/**
* The <code>java.vm.specification.name</code> System Property.
* Java Virtual Machine specification name.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.vm.specification.name</code> System Property. Java Virtual Machine
* specification name.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.2
@ -477,10 +493,10 @@ public class SystemUtils {
public static final String JAVA_VM_SPECIFICATION_NAME = getSystemProperty("java.vm.specification.name");
/**
* The <code>java.vm.specification.vendor</code> System Property.
* Java Virtual Machine specification vendor.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.vm.specification.vendor</code> System Property. Java Virtual
* Machine specification vendor.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.2
@ -488,10 +504,10 @@ public class SystemUtils {
public static final String JAVA_VM_SPECIFICATION_VENDOR = getSystemProperty("java.vm.specification.vendor");
/**
* The <code>java.vm.specification.version</code> System Property.
* Java Virtual Machine specification version.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.vm.specification.version</code> System Property. Java Virtual Machine
* specification version.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.2
@ -499,10 +515,10 @@ public class SystemUtils {
public static final String JAVA_VM_SPECIFICATION_VERSION = getSystemProperty("java.vm.specification.version");
/**
* The <code>java.vm.vendor</code> System Property.
* Java Virtual Machine implementation vendor.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.vm.vendor</code> System Property. Java Virtual Machine implementation
* vendor.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.2
@ -510,10 +526,10 @@ public class SystemUtils {
public static final String JAVA_VM_VENDOR = getSystemProperty("java.vm.vendor");
/**
* The <code>java.vm.version</code> System Property.
* Java Virtual Machine implementation version.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>java.vm.version</code> System Property. Java Virtual Machine
* implementation version.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.2
@ -521,10 +537,10 @@ public class SystemUtils {
public static final String JAVA_VM_VERSION = getSystemProperty("java.vm.version");
/**
* The <code>line.separator</code> System Property.
* Line separator ("\n" on UNIX).
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>line.separator</code> System Property. Line separator
* (<code>&quot;\n<&quot;</code> on UNIX).</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.1
@ -532,10 +548,9 @@ public class SystemUtils {
public static final String LINE_SEPARATOR = getSystemProperty("line.separator");
/**
* The <code>os.arch</code> System Property.
* Operating system architecture.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>os.arch</code> System Property. Operating system architecture.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.1
@ -543,10 +558,9 @@ public class SystemUtils {
public static final String OS_ARCH = getSystemProperty("os.arch");
/**
* The <code>os.name</code> System Property.
* Operating system name.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>os.name</code> System Property. Operating system name.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.1
@ -554,10 +568,9 @@ public class SystemUtils {
public static final String OS_NAME = getSystemProperty("os.name");
/**
* The <code>os.version</code> System Property.
* Operating system version.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>os.version</code> System Property. Operating system version.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.1
@ -565,10 +578,10 @@ public class SystemUtils {
public static final String OS_VERSION = getSystemProperty("os.version");
/**
* The <code>path.separator</code> System Property.
* Path separator (":" on UNIX).
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>path.separator</code> System Property. Path separator
* (<code>&quot;:&quot;</code> on UNIX).</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.1
@ -576,12 +589,11 @@ public class SystemUtils {
public static final String PATH_SEPARATOR = getSystemProperty("path.separator");
/**
* The <code>user.country</code> or <code>user.region</code> System Property.
* User's country code, such as <code>GB</code>.
* First in JDK version 1.2 as <code>user.region</code>.
* Renamed to <code>user.country</code> in 1.4
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>user.country</code> or <code>user.region</code> System Property.
* User's country code, such as <code>GB</code>. First in JDK version 1.2 as
* <code>user.region</code>. Renamed to <code>user.country</code> in 1.4</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.2
@ -591,10 +603,10 @@ public class SystemUtils {
getSystemProperty("user.region") : getSystemProperty("user.country"));
/**
* The <code>user.dir</code> System Property.
* User's current working directory.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>user.dir</code> System Property. User's current working
* directory.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.1
@ -602,10 +614,9 @@ public class SystemUtils {
public static final String USER_DIR = getSystemProperty("user.dir");
/**
* The <code>user.home</code> System Property.
* User's home directory.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>user.home</code> System Property. User's home directory.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.1
@ -613,10 +624,10 @@ public class SystemUtils {
public static final String USER_HOME = getSystemProperty("user.home");
/**
* The <code>user.language</code> System Property.
* User's language code, such as 'en'.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>user.language</code> System Property. User's language code,
* such as 'en'.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.2
@ -624,10 +635,9 @@ public class SystemUtils {
public static final String USER_LANGUAGE = getSystemProperty("user.language");
/**
* The <code>user.name</code> System Property.
* User's account name.
* <p>
* Defaults to <code>null</code> if the runtime does not have
* <p>The <code>user.name</code> System Property. User's account name.</p>
*
* <p>Defaults to <code>null</code> if the runtime does not have
* security access to read this property or the property does not exist.</p>
*
* @since Java 1.1
@ -706,7 +716,7 @@ private static int getJavaVersionAsInt() {
}
/**
* Decides if the java version matches.
* <p>Decides if the java version matches.</p>
*
* @param versionPrefix the prefix for the java version
* @return true if matches, or false if not or can't determine
@ -719,7 +729,7 @@ private static boolean getJavaVersionMatches(String versionPrefix) {
}
/**
* Decides if the operating system matches.
* <p>Decides if the operating system matches.</p>
*
* @param osNamePrefix the prefix for the os name
* @return true if matches, or false if not or can't determine
@ -732,7 +742,7 @@ private static boolean getOSMatches(String osNamePrefix) {
}
/**
* Decides if the operating system matches.
* <p>Decides if the operating system matches.</p>
*
* @param osNamePrefix the prefix for the os name
* @param osVersionPrefix the prefix for the version
@ -747,9 +757,11 @@ private static boolean getOSMatches(String osNamePrefix, String osVersionPrefix)
//-----------------------------------------------------------------------
/**
* Gets a System property, defaulting to <code>null</code> if the property
* cannot be read. If a <code>SecurityException</code> is caught, the return
* value is <code>null</code> and a message is written to <code>System.err</code>.
* <p>Gets a System property, defaulting to <code>null</code> if the property
* cannot be read.</p>
*
* <p>If a <code>SecurityException</code> is caught, the return
* value is <code>null</code> and a message is written to <code>System.err</code>.</p>
*
* @param property the system property name
* @return the system property value or <code>null</code> if a security problem occurs

View File

@ -63,7 +63,7 @@
* @author Stephen Colebourne
* @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
* @version $Id: WordWrapUtils.java,v 1.4 2003/06/08 23:27:26 scolebourne Exp $
* @version $Id: WordWrapUtils.java,v 1.5 2003/07/08 05:59:58 bayard Exp $
*/
public class WordWrapUtils {
@ -82,14 +82,14 @@ public WordWrapUtils() {
//--------------------------------------------------------------------------
/**
* Wraps a block of text to a specified line length.
* <p>
* This method takes a block of text, which might have long lines in it
* <p>Wraps a block of text to a specified line length.</p>
*
* <p>This method takes a block of text, which might have long lines in it
* and wraps the long lines based on the supplied wrapColumn parameter.
* It was initially implemented for use by VelocityEmail. If there are tabs
* in inString, you are going to get results that are a bit strange,
* since tabs are a single character but are displayed as 4 or 8
* spaces. Remove the tabs.
* spaces. Remove the tabs.</p>
*
* @param str text which is in need of word-wrapping
* @param newline the characters that define a newline
@ -121,8 +121,8 @@ public static String wrapText(String str, String newline, int wrapColumn) {
}
/**
* Wraps a single line of text.
* Called by wrapText() to do the real work of wrapping.
* <p>Wraps a single line of text. Called by wrapText() to do the real
* work of wrapping.</p>
*
* @param line a line which is in need of word-wrapping
* @param newline the characters that define a newline
@ -170,23 +170,23 @@ private static String wrapLine(String line, String newline, int wrapColumn) {
//--------------------------------------------------------------------------
/**
* Create a word-wrapped version of a String. Wrap at 80 characters and
* <p>Create a word-wrapped version of a String. Wrap at 80 characters and
* use newlines as the delimiter. If a word is over 80 characters long
* use a - sign to split it.
* use a - sign to split it.</p>
*/
public static String wordWrap(String str) {
return wordWrap(str, 80, "\n", "-");
}
/**
* Create a word-wrapped version of a String. Wrap at a specified width and
* <p>Create a word-wrapped version of a String. Wrap at a specified width and
* use newlines as the delimiter. If a word is over the width in lenght
* use a - sign to split it.
* use a - sign to split it.</p>
*/
public static String wordWrap(String str, int width) {
return wordWrap(str, width, "\n", "-");
}
/**
* Word-wrap a string.
* <p>Word-wrap a string.</p>
*
* @param str String to word-wrap
* @param width int to wrap at