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 String
checkPosixCharClass
(char[] buffer) (package private) static Strings.PatternState
checkWildCards
(String pattern) (package private) static Pattern
convertGlob
(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 String
private static boolean
escapedByBackslash
(char nextChar) (package private) static char
getPathSeparator
(Character pathSeparator) private static boolean
isComplexWildcard
(String pattern) static boolean
isDirectoryPattern
(String pattern) Check if pattern is a directory pattern ending with a path separator(package private) static boolean
isWildCard
(String pattern) private static char
private static char
lookBehind
(StringBuilder buffer) private static void
reset
(char[] buffer) private static void
setNext
(char[] buffer, char c) Splits given string to substrings by given separatorstatic String
stripTrailing
(String pattern, char c) Strip trailing charactersstatic String
stripTrailingWhitespace
(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:
true
if 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
-