Copyright (c) 2000-2002 ChurchillObjects.com

churchillobjects.rss4j.model
Class DateLanguageUtil

java.lang.Object
  |
  +--churchillobjects.rss4j.model.DateLanguageUtil

public class DateLanguageUtil
extends java.lang.Object

Static functionality class that provides locale-type support, such as identifying standard languages and ISO 8601 dates.


Field Summary
private static java.lang.String[][] languages
          Hard-coded list of world languages and codes.
 
Constructor Summary
private DateLanguageUtil()
          Prevent this class from being instantiated.
 
Method Summary
static java.util.Date convert8601ToDate(java.lang.String date)
          Formats a date as an ISO8601 date-string.
static java.lang.String convertDateTo8601(java.util.Date date)
          Converts a java.util.Date object to a string-represented ISO 8601 date.
static boolean isValidLanguage(java.lang.String s)
          Identifies if a specified language code is valid (in the list).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

languages

private static java.lang.String[][] languages
Hard-coded list of world languages and codes.

Constructor Detail

DateLanguageUtil

private DateLanguageUtil()
Prevent this class from being instantiated.

Method Detail

isValidLanguage

public static boolean isValidLanguage(java.lang.String s)
Identifies if a specified language code is valid (in the list).

Parameters:
s - The language code
Returns:
If the code is valid

convertDateTo8601

public static java.lang.String convertDateTo8601(java.util.Date date)
Converts a java.util.Date object to a string-represented ISO 8601 date. This conversion is limited by not using seconds (which are not of interest to RSS feeds) and also always setting the timezone to UTC (the 'Z' at the end).

Parameters:
date -
Returns:

convert8601ToDate

public static java.util.Date convert8601ToDate(java.lang.String date)
                                        throws java.text.ParseException
Formats a date as an ISO8601 date-string. Does not work with some 8601 features, such as weeks. (Perhaps another library should be created?) It also ignores seconds and fractions of seconds, which probably are not of much interest in RSS feeds.

Parameters:
date -
Returns:
Throws:
java.text.ParseException

Copyright (c) 2000-2002 ChurchillObjects.com