|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vostok.glob.Glob
public class Glob
This class provide a glob implementation, using the same signature as Pattern.
Glob is a pattern matching behavior, but using fewer action, a more simple syntax, no sub selection and only intented to match string against a pattern. It's therefore much faster than using a regexp. A typical use is to validate en input, match a file name against a pattern, like *.jpg or *.r[0-9], etc...
This implementation recognize * ? grouping - with range - escape char and can work on case insensitive/sensitive pattern
Syntax is based on the linux' bash one.
Limitations :
Asterisk :
Match is done from begining of the string to the end.
Cost of a case insensitive operation :
the cost of an case insensitive operation is 1 time convertion to lower case of pattern and one 1 convertion of input for
each Glob.matches call.
Field Summary | |
---|---|
static int |
CASE_INSENSITIVE
|
static int |
CASE_SENSITIVE
|
Method Summary | |
---|---|
static Glob |
compile(java.lang.String pattern)
compile a new Glob parser, with CASE_INSENSITIVE matching |
static Glob |
compile(java.lang.String pattern,
int flag)
compile a new Glob parser |
boolean |
matches(java.lang.CharSequence input)
try to match an input data |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static int CASE_SENSITIVE
public static int CASE_INSENSITIVE
Method Detail |
---|
public static Glob compile(java.lang.String pattern) throws java.util.regex.PatternSyntaxException
pattern
-
java.util.regex.PatternSyntaxException
- if pattern is not validpublic static Glob compile(java.lang.String pattern, int flag) throws java.util.regex.PatternSyntaxException
pattern
- flag
- can be Glob.CASE_SENSITIVE or Glob.CASE_INSENSITIVE
java.util.regex.PatternSyntaxException
- if pattern is not validpublic boolean matches(java.lang.CharSequence input)
input
- data to check againt the glob pattern. can be empty but not null
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |