org.abstracthorizon.mercury.common.util
Class RFCDate

java.lang.Object
  extended by org.abstracthorizon.mercury.common.util.RFCDate
All Implemented Interfaces:
Serializable

public class RFCDate
extends Object
implements Serializable

Class that represents RFC's date

Author:
Daniel Sendula
See Also:
Serialized Form

Field Summary
static SimpleDateFormat DATE_FORMAT
          Date format
protected  String dateString
          Date string
protected  int day
          Day
protected  int hour
          Hour
protected  int l
           
protected  int minute
          Minute\
protected  int month
          Month
protected  int p
           
protected  int second
          Second
protected  int timezone
          Timezone
protected  String timezoneId
          Timezone Id
protected  boolean valid
          Is valid date or not
protected  int year
          Year
 
Constructor Summary
RFCDate(String s)
          Constructor
 
Method Summary
protected  boolean character(char ch)
          Checks next character is given character
protected  int digit()
          Returns digit (oc next character) or -1
 Calendar getCalendar()
          Returns calendar
 Date getDate()
          Returns date
 boolean isValid()
          Returns is date valid
static void main(String[] args)
           
protected  boolean parse()
          Parses date
protected  boolean parseDay()
          Parses day
protected  boolean parseDayOfWeek()
          Parses day of week
protected  boolean parseHour()
          Parses hour
protected  boolean parseMinute()
          Parses minute
protected  boolean parseMonth()
          Parses month
protected  boolean parseSecond()
          Parses second
protected  boolean parseTimeZone()
          Parses timezone
protected  boolean parseYear()
          Parses year
static void test(String d)
           
protected  boolean trim()
          Trims date string
static boolean validate(String s)
          Validates given date string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATE_FORMAT

public static final SimpleDateFormat DATE_FORMAT
Date format


dateString

protected transient String dateString
Date string


day

protected int day
Day


month

protected int month
Month


year

protected int year
Year


hour

protected int hour
Hour


minute

protected int minute
Minute\


second

protected int second
Second


timezone

protected int timezone
Timezone


timezoneId

protected String timezoneId
Timezone Id


valid

protected boolean valid
Is valid date or not


p

protected transient int p

l

protected transient int l
Constructor Detail

RFCDate

public RFCDate(String s)
Constructor

Parameters:
s - date
Method Detail

isValid

public boolean isValid()
Returns is date valid

Returns:
is date valid

trim

protected boolean trim()
Trims date string

Returns:
trims date string

parseDayOfWeek

protected boolean parseDayOfWeek()
Parses day of week

Returns:
true if valid

character

protected boolean character(char ch)
Checks next character is given character

Parameters:
ch - character to be checked with
Returns:
true if next character is given character

digit

protected int digit()
Returns digit (oc next character) or -1

Returns:
digit (oc next character) or -1

parseDay

protected boolean parseDay()
Parses day

Returns:
true if valid

parseMonth

protected boolean parseMonth()
Parses month

Returns:
true if valid

parseYear

protected boolean parseYear()
Parses year

Returns:
true if valid

parseHour

protected boolean parseHour()
Parses hour

Returns:
true if valid

parseMinute

protected boolean parseMinute()
Parses minute

Returns:
true if valid

parseSecond

protected boolean parseSecond()
Parses second

Returns:
true if valid

parseTimeZone

protected boolean parseTimeZone()
Parses timezone

Returns:
true if valid

parse

protected boolean parse()
Parses date

Returns:
true if valid

getDate

public Date getDate()
Returns date

Returns:
date

getCalendar

public Calendar getCalendar()
Returns calendar

Returns:
calendar

validate

public static boolean validate(String s)
Validates given date string

Parameters:
s - date string
Returns:
true if valid

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception

test

public static void test(String d)


Copyright © 2005-2009 Abstract Horizon. All Rights Reserved.