Package org.eclipse.jgit.ignore.internal
Class Strings
java.lang.Object
org.eclipse.jgit.ignore.internal.Strings
Various
String related utility methods, written mostly to
avoid generation of new String objects (e.g. via splitting Strings etc).-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringcheckPosixCharClass(char[] buffer) (package private) static Strings.PatternStatecheckWildCards(String pattern) (package private) static PatternconvertGlob(String pattern) Conversion from glob to Java regex following two sources: http://man7.org/linux/man-pages/man7/glob.7.html org.eclipse.jgit.fnmatch.FileNameMatcher.java Seems that there are various ways to define what "glob" can be.(package private) static int(package private) static Stringprivate static booleanescapedByBackslash(char nextChar) (package private) static chargetPathSeparator(Character pathSeparator) private static booleanisComplexWildcard(String pattern) static booleanisDirectoryPattern(String pattern) Check if pattern is a directory pattern ending with a path separator(package private) static booleanisWildCard(String pattern) private static charprivate static charlookBehind(StringBuilder buffer) private static voidreset(char[] buffer) private static voidsetNext(char[] buffer, char c) Splits given string to substrings by given separatorstatic StringstripTrailing(String pattern, char c) Strip trailing charactersstatic StringstripTrailingWhitespace(String pattern) Strip trailing whitespace characters
-
Field Details
-
POSIX_CHAR_CLASSES
-
DL
- See Also:
-
JAVA_CHAR_CLASSES
-
UNSUPPORTED
-
-
Constructor Details
-
Strings
public Strings()
-
-
Method Details
-
getPathSeparator
-
stripTrailing
Strip trailing characters- Parameters:
pattern- non nullc- character to remove- Returns:
- new string with all trailing characters removed
-
stripTrailingWhitespace
Strip trailing whitespace characters- Parameters:
pattern- non null- Returns:
- new string with all trailing whitespace removed
-
isDirectoryPattern
Check if pattern is a directory pattern ending with a path separator- Parameters:
pattern- non null- Returns:
trueif the last character, which is not whitespace, is a path separator
-
count
-
split
Splits given string to substrings by given separator- Parameters:
pattern- non nullslash- separator char- Returns:
- list of substrings
-
isWildCard
-
isComplexWildcard
-
escapedByBackslash
private static boolean escapedByBackslash(char nextChar) -
checkWildCards
-
convertGlob
Conversion from glob to Java regex following two sources:- http://man7.org/linux/man-pages/man7/glob.7.html
- org.eclipse.jgit.fnmatch.FileNameMatcher.java Seems that there are various ways to define what "glob" can be.
- Parameters:
pattern- non null pattern- Returns:
- Java regex pattern corresponding to given glob pattern
- Throws:
InvalidPatternException
-
lookBehind
- Parameters:
buffer-- Returns:
- zero of the buffer is empty, otherwise the last character from buffer
-
lookAhead
- Parameters:
pattern-i- current pointer in the pattern- Returns:
- zero of the index is out of range, otherwise the next character from given position
-
setNext
private static void setNext(char[] buffer, char c) -
reset
private static void reset(char[] buffer) -
checkPosixCharClass
-
deleteBackslash
-