com.dyuproject.util.validate
Class IPDomainValidator

java.lang.Object
  extended by com.dyuproject.util.validate.IPDomainValidator

public final class IPDomainValidator
extends Object

A string input validator for IPs and domains.

Author:
David Yu
Date created:
Jan 10, 2009

Field Summary
static int ALPHANUMERIC
           
static int HYPHENATED
           
static int INVALID
           
static int IP
           
static int MIXED
           
static int PLAIN
           
 
Constructor Summary
IPDomainValidator()
           
 
Method Summary
static int indexOf(char[] ch, char c, int start)
          Returns the index of the char c from the char array ch.
static boolean isValid(char[] domain)
          Checks whether the char array domain is valid.
static boolean isValid(char[] domain, int start, int end)
          Checks whether the char array domain is valid.
static boolean isValid(String domain)
          Checks whether the string domain is valid.
static boolean isValid(String domain, int start, int end)
          Checks whether the string domain is valid.
static int lastIndexOf(char[] ch, char c, int start)
          Returns the index (starting from the last) of the char c from the array of characters ch.
static int tokenValidate(char[] part, int start, int len)
          Returns 0 if the char array part is invalid.
static int validate(char[] domain)
          Returns 0 if the char array domain is invalid.
static int validate(char[] domain, int start, int end)
          Returns 0 if the char array domain is invalid.
static int validate(String domain)
          Returns 0 if the string domain is invalid.
static int validate(String domain, int start, int end)
          Returns 0 if the string domain is invalid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INVALID

public static final int INVALID
See Also:
Constant Field Values

PLAIN

public static final int PLAIN
See Also:
Constant Field Values

ALPHANUMERIC

public static final int ALPHANUMERIC
See Also:
Constant Field Values

HYPHENATED

public static final int HYPHENATED
See Also:
Constant Field Values

MIXED

public static final int MIXED
See Also:
Constant Field Values

IP

public static final int IP
See Also:
Constant Field Values
Constructor Detail

IPDomainValidator

public IPDomainValidator()
Method Detail

tokenValidate

public static int tokenValidate(char[] part,
                                int start,
                                int len)
Returns 0 if the char array part is invalid.


indexOf

public static int indexOf(char[] ch,
                          char c,
                          int start)
Returns the index of the char c from the char array ch.


lastIndexOf

public static int lastIndexOf(char[] ch,
                              char c,
                              int start)
Returns the index (starting from the last) of the char c from the array of characters ch.


validate

public static int validate(String domain,
                           int start,
                           int end)
Returns 0 if the string domain is invalid.


validate

public static int validate(String domain)
Returns 0 if the string domain is invalid.


validate

public static int validate(char[] domain)
Returns 0 if the char array domain is invalid.


validate

public static int validate(char[] domain,
                           int start,
                           int end)
Returns 0 if the char array domain is invalid.


isValid

public static boolean isValid(String domain)
Checks whether the string domain is valid.


isValid

public static boolean isValid(char[] domain)
Checks whether the char array domain is valid.


isValid

public static boolean isValid(String domain,
                              int start,
                              int end)
Checks whether the string domain is valid.


isValid

public static boolean isValid(char[] domain,
                              int start,
                              int end)
Checks whether the char array domain is valid.



Copyright © 2008-2013. All Rights Reserved.