Home » jakarta-jmeter-2.3.4_src » org.apache.jorphan.util » [javadoc | source]
org.apache.jorphan.util
public final class: JOrphanUtils [javadoc | source]
java.lang.Object
   org.apache.jorphan.util.JOrphanUtils
This class contains frequently-used static utility methods.
Method from org.apache.jorphan.util.JOrphanUtils Summary:
baToHexString,   booleanToSTRING,   closeQuietly,   closeQuietly,   closeQuietly,   closeQuietly,   closeQuietly,   closeQuietly,   getByteArraySlice,   isXML,   leftAlign,   replaceAllChars,   replaceFirst,   rightAlign,   split,   split,   split,   startsWith,   substitute,   trim
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.jorphan.util.JOrphanUtils Detail:
 public static String baToHexString(byte[] ba) 
    Convert binary byte array to hex string.
 public static String booleanToSTRING(boolean value) 
    Convert a boolean to its string representation Equivalent to Boolean.valueOf(boolean).toString().toUpperCase() but valid also for JDK 1.3, which does not have valueOf(boolean)
 public static  void closeQuietly(InputStream is) 
    close a stream with no error thrown
 public static  void closeQuietly(OutputStream os) 
    close a stream with no error thrown
 public static  void closeQuietly(Writer wr) 
    close a Writer with no error thrown
 public static  void closeQuietly(Reader rd) 
    close a Reader with no error thrown
 public static  void closeQuietly(Socket sock) 
    close a Socket with no error thrown
 public static  void closeQuietly(ServerSocket sock) 
    close a Socket with no error thrown
 public static byte[] getByteArraySlice(byte[] array,
    int begin,
    int end) 
    Returns a slice of a byte array. TODO - add bounds checking?
 public static boolean isXML(byte[] target) 
    Detects if some content starts with the standard XML prefix.
 public static StringBuffer leftAlign(StringBuffer in,
    int len) 
    Left aligns some text in a StringBuffer N.B. modifies the input buffer
 public static String replaceAllChars(String source,
    char search,
    String replace) 
    Version of String.replaceAll() for JDK1.3 See below for another version which replaces strings rather than chars
 public static String replaceFirst(String source,
    String search,
    String replace) 
    Simple-minded String.replace() for JDK1.3 Should probably be recoded...
 public static StringBuffer rightAlign(StringBuffer in,
    int len) 
    Right aligns some text in a StringBuffer N.B. modifies the input buffer
 public static String[] split(String splittee,
    String splitChar) 
 public static String[] split(String splittee,
    String splitChar,
    boolean truncate) 
    This is _almost_ equivalent to the String.split method in JDK 1.4. It is here to enable us to support earlier JDKs. Note that unlike JDK1.4 split(), it optionally ignores leading split Characters, and the splitChar parameter is not a Regular expression

    This piece of code used to be part of JMeterUtils, but was moved here because some JOrphan classes use it too.

 public static String[] split(String splittee,
    String delims,
    String def) 
    Takes a String and a tokenizer character string, and returns a new array of strings of the string split by the tokenizer character(s). Trailing delimiters are significant (unless the default = null)
 public static boolean startsWith(byte[] target,
    byte[] search,
    int offset) 
    Check if a byte array starts with the given byte array.
 public static String substitute(String input,
    String pattern,
    String sub) 
    Replace all patterns in a String
 public static String trim(String input,
    String delims) 
    Trim a string by the tokens provided.