|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.puppycrawl.tools.checkstyle.api.Utils
public final class Utils
Contains utility methods.
| Method Summary | |
|---|---|
static java.lang.String |
baseClassname(java.lang.String aType)
|
static void |
closeQuietly(java.io.Closeable aShutting)
Closes the supplied Closeable object ignoring an
IOException if it is thrown. |
static java.util.regex.Pattern |
createPattern(java.lang.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 java.lang.String[] |
getLines(java.lang.String aFileName)
Deprecated. consider using FileText instead |
static java.lang.String[] |
getLines(java.lang.String aFileName,
java.lang.String aCharsetName)
Deprecated. consider using FileText instead |
static java.util.regex.Pattern |
getPattern(java.lang.String aPattern)
This is a factory method to return an Pattern object for the specified regular expression. |
static java.util.regex.Pattern |
getPattern(java.lang.String aPattern,
int aCompileFlags)
This is a factory method to return an Pattern object for the specified regular expression and compile flags. |
static java.lang.String |
getStrippedFileName(java.lang.String aBasedir,
java.lang.String aFileName)
Create a stripped down version of a filename. |
static int |
lengthExpandedTabs(java.lang.String aString,
int aToIdx,
int aTabWidth)
Returns the length of a String prefix with tabs expanded. |
static int |
lengthMinusTrailingWhitespace(java.lang.String aLine)
Returns the length of a string ignoring all trailing whitespace. |
static boolean |
whitespaceBefore(int aIndex,
java.lang.String aLine)
Returns whether the specified string contains only whitespace up to the specified index. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static org.apache.commons.logging.Log getExceptionLogger()
FileSetCheck
work (debug() should be used).
public static boolean whitespaceBefore(int aIndex,
java.lang.String aLine)
aIndex - index to check up toaLine - the line to check
public static int lengthMinusTrailingWhitespace(java.lang.String aLine)
aLine - the string to process
public static int lengthExpandedTabs(java.lang.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 java.util.regex.Pattern getPattern(java.lang.String aPattern)
throws java.util.regex.PatternSyntaxException
getPattern(String, int) with the
compile flags defaults to 0.
aPattern - the regular expression pattern
java.util.regex.PatternSyntaxException - an invalid pattern was supplied
public static java.util.regex.Pattern getPattern(java.lang.String aPattern,
int aCompileFlags)
throws java.util.regex.PatternSyntaxException
This method is not MT safe, but neither are the returned Pattern objects.
aPattern - the regular expression patternaCompileFlags - the compilation flags
java.util.regex.PatternSyntaxException - an invalid pattern was supplied
@Deprecated
public static java.lang.String[] getLines(java.lang.String aFileName)
throws java.io.IOException
FileText instead
aFileName - the name of the file to load
java.io.IOException - error occurred
@Deprecated
public static java.lang.String[] getLines(java.lang.String aFileName,
java.lang.String aCharsetName)
throws java.io.IOException
FileText instead
aFileName - the name of the file to loadaCharsetName - the name of a supported charset
java.io.IOException - error occurred
public static java.util.regex.Pattern createPattern(java.lang.String aPattern)
throws org.apache.commons.beanutils.ConversionException
aPattern - the pattern to match
org.apache.commons.beanutils.ConversionException - if unable to create Pattern object.public static java.lang.String baseClassname(java.lang.String aType)
aType - the fully qualified name. Cannot be null
public static java.lang.String getStrippedFileName(java.lang.String aBasedir,
java.lang.String aFileName)
aBasedir - the prefix to strip off the original filenameaFileName - the original filename
public static void closeQuietly(java.io.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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||