gov.nasa.pds.citool.util
Class Utility

java.lang.Object
  extended by gov.nasa.pds.citool.util.Utility

public class Utility
extends Object


Constructor Summary
Utility()
           
 
Method Summary
static String collapse(String source)
          Method to remove extra spaces from the string specified by the string attributes.
static String filterString(String value)
           
static String getDateTime()
          Get the current date time.
static boolean isNull(String value)
          Determines whether a value is null as defined by the PDS.
static String itrim(String source)
          Replace multiple whitespaces between words with single blank
static String ltrim(String source)
          Trim the string of any spaces on the left end (ie., leading spaces removed) Remove leading spaces for each line when there is multiple lines of string
static String printDiff(String indent, List<DiffRecord> records)
           
static List<String> removeQuotes(List<String> list)
           
static String replaceChars(String strToReplace)
           
static String rtrim(String source)
          Trim the string of any spaces on the right end (ie., trailing spaces removed)
static String stripNewLines(String value)
           
static String stripOnlyWhitespaceAndNewLine(String value)
          Strips only newline characters and extra whitespaces.
static String stripWhitespace(String value)
           
static URL toURL(String s)
          Convert a string to a URL.
static String trimString(String value, int length)
           
static boolean valueExists(String value, List<String> lists)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utility

public Utility()
Method Detail

stripWhitespace

public static String stripWhitespace(String value)

stripNewLines

public static String stripNewLines(String value)

filterString

public static String filterString(String value)

trimString

public static String trimString(String value,
                                int length)

stripOnlyWhitespaceAndNewLine

public static String stripOnlyWhitespaceAndNewLine(String value)
Strips only newline characters and extra whitespaces.

Parameters:
value - A string value.
Returns:
The filtered value.

collapse

public static String collapse(String source)
Method to remove extra spaces from the string specified by the string attributes. It returns the collapsed string without any additional spaces at the beginning of the string and '\r\n' characters. Example (orignal line): OBJECT = "THIS LINE IS BAD" (collapsed): OBJECT = "THIS LINE IS BAD"


itrim

public static String itrim(String source)
Replace multiple whitespaces between words with single blank


ltrim

public static String ltrim(String source)
Trim the string of any spaces on the left end (ie., leading spaces removed) Remove leading spaces for each line when there is multiple lines of string


rtrim

public static String rtrim(String source)
Trim the string of any spaces on the right end (ie., trailing spaces removed)


isNull

public static boolean isNull(String value)
Determines whether a value is null as defined by the PDS.

Parameters:
value - The value in question
Returns:
true if the value is null, false otherwise.

removeQuotes

public static List<String> removeQuotes(List<String> list)

toURL

public static URL toURL(String s)
                 throws MalformedURLException
Convert a string to a URL.

Parameters:
s - The string to convert
Returns:
A URL of the input string
Throws:
MalformedURLException

getDateTime

public static String getDateTime()
Get the current date time.

Returns:
A date time.

printDiff

public static String printDiff(String indent,
                               List<DiffRecord> records)

replaceChars

public static String replaceChars(String strToReplace)

valueExists

public static boolean valueExists(String value,
                                  List<String> lists)


Copyright © 2010–2014 Planetary Data System. All rights reserved.