org.apache.pluto.util
Class StringUtils

java.lang.Object
  extended by org.apache.pluto.util.StringUtils

public class StringUtils
extends java.lang.Object

Static class hosting a couple of utility methods around strings.


Method Summary
static java.lang.String[] copy(java.lang.String[] source)
          TODO: can't we just use String[].clone()?
static java.util.Map copyParameters(java.util.Map parameters)
          Deep-clones a parameter map.
static java.lang.String getMimeTypeWithoutEncoding(java.lang.String mimeType)
          Strips the specified mime type by removing the character encoding specified at the end of the mime type (all characters after the ';').
static java.lang.String replace(java.lang.String source, java.lang.String pattern, java.lang.String replace)
          Replaces all occurrences of a pattern within a string by a replacement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

replace

public static java.lang.String replace(java.lang.String source,
                                       java.lang.String pattern,
                                       java.lang.String replace)
Replaces all occurrences of a pattern within a string by a replacement.

Parameters:
source - the string that should be searched.
pattern - the pattern that should be replaced.
replace - the replacement that should be inserted instead of the pattern.
Returns:
The updated source string.

copy

public static java.lang.String[] copy(java.lang.String[] source)
TODO: can't we just use String[].clone()?

Parameters:
source -
Returns:

copyParameters

public static java.util.Map copyParameters(java.util.Map parameters)
Deep-clones a parameter map. The key is the parameter name as a String instance, while the value is a String array (String[]) instance.

Parameters:
parameters - the parameter map to deep-clone.
Returns:
the deep-cloned parameter map.

getMimeTypeWithoutEncoding

public static java.lang.String getMimeTypeWithoutEncoding(java.lang.String mimeType)
Strips the specified mime type by removing the character encoding specified at the end of the mime type (all characters after the ';'). The stripped mime type is trimmed string which contains no white spaces at the beginning and the end.

Parameters:
mimeType - the mime type to strip.
Returns:
the stripped mime type.


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.