public final class Utils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
baseClassname(String aType) |
static void |
closeQuietly(Closeable aShutting)
Closes the supplied
Closeable object ignoring an
IOException if it is thrown. |
static Pattern |
createPattern(String aPattern)
Helper method to create a regular expression.
|
static org.apache.commons.logging.Log |
getExceptionLogger()
Accessor for shared instance of logger which should be
used to log all exceptions occurred during
FileSetCheck
work (debug() should be used). |
static String[] |
getLines(String aFileName)
Deprecated.
consider using
FileText instead |
static String[] |
getLines(String aFileName,
String aCharsetName)
Deprecated.
consider using
FileText instead |
static Pattern |
getPattern(String aPattern)
This is a factory method to return an Pattern object for the specified
regular expression.
|
static Pattern |
getPattern(String aPattern,
int aCompileFlags)
This is a factory method to return an Pattern object for the specified
regular expression and compile flags.
|
static String |
getStrippedFileName(String aBasedir,
String aFileName)
Create a stripped down version of a filename.
|
static int |
lengthExpandedTabs(String aString,
int aToIdx,
int aTabWidth)
Returns the length of a String prefix with tabs expanded.
|
static int |
lengthMinusTrailingWhitespace(String aLine)
Returns the length of a string ignoring all trailing whitespace.
|
static boolean |
whitespaceBefore(int aIndex,
String aLine)
Returns whether the specified string contains only whitespace up to the
specified index.
|
public static org.apache.commons.logging.Log getExceptionLogger()
FileSetCheck
work (debug() should be used).public static boolean whitespaceBefore(int aIndex,
String aLine)
aIndex - index to check up toaLine - the line to checkpublic static int lengthMinusTrailingWhitespace(String aLine)
aLine - the string to processpublic static int lengthExpandedTabs(String aString, int aToIdx, int aTabWidth)
aString - the input StringaToIdx - index in aString (exclusive) where the calculation stopsaTabWidth - the distance between tab stop position.public static Pattern getPattern(String aPattern) throws PatternSyntaxException
getPattern(String, int) with the
compile flags defaults to 0.aPattern - the regular expression patternPatternSyntaxException - an invalid pattern was suppliedpublic static Pattern getPattern(String aPattern, int aCompileFlags) throws PatternSyntaxException
This method is not MT safe, but neither are the returned Pattern objects.
aPattern - the regular expression patternaCompileFlags - the compilation flagsPatternSyntaxException - an invalid pattern was supplied@Deprecated public static String[] getLines(String aFileName) throws IOException
FileText insteadaFileName - the name of the file to loadIOException - error occurred@Deprecated public static String[] getLines(String aFileName, String aCharsetName) throws IOException
FileText insteadaFileName - the name of the file to loadaCharsetName - the name of a supported charsetIOException - error occurredpublic static Pattern createPattern(String aPattern) throws org.apache.commons.beanutils.ConversionException
aPattern - the pattern to matchorg.apache.commons.beanutils.ConversionException - if unable to create Pattern object.public static String baseClassname(String aType)
aType - the fully qualified name. Cannot be nullpublic static String getStrippedFileName(String aBasedir, String aFileName)
aBasedir - the prefix to strip off the original filenameaFileName - the original filenamepublic static void closeQuietly(Closeable aShutting)
Closeable object ignoring an
IOException if it is thrown. Honestly, what are you going to
do if you cannot close a file.aShutting - the object to be closed.Copyright © 2001-2012. All Rights Reserved.