bbc.rd.tvanytime.util
Class DVBLocatorToolbox

java.lang.Object
  extended by bbc.rd.tvanytime.util.DVBLocatorToolbox

public class DVBLocatorToolbox
extends java.lang.Object

DVBLocatorToolbox: A class (which should be treated as abstract) offering useful methods on DVB Locators.
This version accepts DVB locator strings in the following forms which are all compliant with the extended DVB Locator defined in ETSI TS 102 822-3-1 (V1.1.1): "dvb://233a.1004.1084;6f2c@2001-12-08T02:50:00--PT00H10M45S" "dvb://233a.1004.1084;6f2c@2001-12-08T02:50:00Z--PT00H10M45S" "dvb://233a.1004.1084;6f2c@2001-12-08T02:50:00+01--PT00H10M45S" "dvb://233a.1004.1084;6f2c@2001-12-08T02:50:00+01:00--PT00H10M45S" It will also accept locators where the "--" symbols are replaced by "/" although this is not DVB compliant.

Version:
1.1
Author:
Tim Sargeant, BBC Research & Development, May 2003, Chris Newell, BBC Research * Development, Nov 2004

Method Summary
static java.util.Date getDate(java.lang.String locator)
          Get the date part of the locator.
static Duration getDuration(java.lang.String locator)
          Get the duration part of the locator.
static java.lang.String getDVBTriplet(java.lang.String locator)
          Get the DVB triplet part of the DVBLocator
static java.lang.String getEventID(java.lang.String locator)
          Get the event_id part of the DVBLocator
static java.lang.String getTvaID(java.lang.String locator)
          Get the TVA_id part of the DVBLocator
static boolean isDVBLocator(java.lang.String locator)
          Checks whether this is a DVBLocator
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDVBTriplet

public static java.lang.String getDVBTriplet(java.lang.String locator)
                                      throws TVAnytimeException
Get the DVB triplet part of the DVBLocator

Returns:
the String representation of the DVB triplet (e.g. "233a.1004.1084") or null if DVB triplet cannot be found.
Throws:
TVAnytimeException - thrown when locator does not start with 'dvb://'

getEventID

public static java.lang.String getEventID(java.lang.String locator)
                                   throws TVAnytimeException
Get the event_id part of the DVBLocator

Returns:
the String representation of the event ID (e.g. "6f2b") or null if event ID doesn't exist.
Throws:
TVAnytimeException - thrown when locator does not start with 'dvb://'

getTvaID

public static java.lang.String getTvaID(java.lang.String locator)
                                 throws TVAnytimeException
Get the TVA_id part of the DVBLocator

Returns:
the String representation of the TVA_id (e.g. "6f2b") or null if TVA_id doesn't exist.
Throws:
TVAnytimeException - thrown when locator does not start with 'dvb://'

getDate

public static java.util.Date getDate(java.lang.String locator)
                              throws TVAnytimeException
Get the date part of the locator.

This method currently accepts "--" or "/" as separators to delineate the date/time and duration. However, the use of "/" is not DVB compliant and is deprecated.

Returns:
the date part of the DVBLocator as a java Date object or null if there is no time_constraint.
Throws:
TVAnytimeException - if the locator is invalid.

getDuration

public static Duration getDuration(java.lang.String locator)
                            throws TVAnytimeException
Get the duration part of the locator.

The method currently accepts "--" or "/" as separators to delineate the date/time and duration. However, the use of "/" is not DVB compliant and is deprecated.

Returns:
the duration part of the DVBLocator as a bbc.rd.tvanytime.Duration object or null if there is no time_constraint.
Throws:
TVAnytimeException - if the locator is invalid.

isDVBLocator

public static boolean isDVBLocator(java.lang.String locator)
Checks whether this is a DVBLocator

Returns:
true if this locator starts with "dvb://", false if it starts with anything else