com.adobe.mediacore.utils
Class StringUtils

java.lang.Object
  extended by com.adobe.mediacore.utils.StringUtils

public final class StringUtils
extends Object

Class containing various helper methods related to strings.


Constructor Summary
StringUtils()
           
 
Method Summary
static Metadata extractFromString(String input, String groupDelimiter, String valueDelimiter)
          Parses the description string and puts the key/value pairs in a Metadata object.
static String getFileExtension(String url)
          Retrieves file extension for the provided url.
static String[] getReunion(String[] array1, String[] array2)
          Returns the reunion of the two arrays.
static boolean isEmpty(String value)
          Checks if the string is null or contains only spaces.
static String trimQuotes(String input)
          Remove the leading and trailing quotes from the input string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtils

public StringUtils()
Method Detail

isEmpty

public static boolean isEmpty(String value)
Checks if the string is null or contains only spaces.

Parameters:
value - the value to be checked
Returns:
true if the string is really "empty" and false otherwise.

getFileExtension

public static String getFileExtension(String url)
Retrieves file extension for the provided url. This is needed for automatically detecting the type of the media being provided.

Parameters:
url - the url to be scanned for a file extension
Returns:
the file extension of the stream or null if no extension was found.

getReunion

public static String[] getReunion(String[] array1,
                                  String[] array2)
Returns the reunion of the two arrays. Returns an empty String array, if both arrays are null.

Parameters:
array1 - the first array.
array2 - the second array.
Returns:
the reunion.

trimQuotes

public static String trimQuotes(String input)
Remove the leading and trailing quotes from the input string. For instance, if the input is *"input text"*, then *input text* is returned.

Parameters:
input - The input string
Returns:
The string without the leading and trailing quotes.

extractFromString

public static Metadata extractFromString(String input,
                                         String groupDelimiter,
                                         String valueDelimiter)
Parses the description string and puts the key/value pairs in a Metadata object.

Parameters:
input - The string containing the key-value pairs.
groupDelimiter - The delimiter between key/value pairs.
valueDelimiter - The delimiter between keys and values inside a group.
Returns:
the Metadata associated to the input.