public final class EncodingSchemeUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static org.opencastproject.util.data.Function<DublinCoreValue,org.opencastproject.util.data.Option<Date>> |
dcValueToDate
|
static org.opencastproject.util.data.Function<String,org.opencastproject.util.data.Option<Date>> |
stringToDate
decodeDate(String) as a function. |
| Modifier and Type | Method and Description |
|---|---|
static Date |
decodeDate(DublinCoreValue value)
Tries to decode the given value as a W3C-DTF encoded date.
|
static Date |
decodeDate(String value)
Tries to decode the given value as a W3C-DTF encoded date.
|
static Long |
decodeDuration(DublinCoreValue value)
Decode a string encoded in the ISO8601 encoding scheme.
|
static Long |
decodeDuration(String value)
Decode a string encoded in the ISO8601 encoding scheme.
|
static Date |
decodeMandatoryDate(DublinCoreValue value)
Like
decodeDate(String), but throws an IllegalArgumentException if the value cannot be decoded. |
static Date |
decodeMandatoryDate(String value)
Like
decodeDate(String), but throws an IllegalArgumentException if the value cannot be decoded. |
static Long |
decodeMandatoryDuration(DublinCoreValue value) |
static Long |
decodeMandatoryDuration(String value) |
static DCMIPeriod |
decodeMandatoryPeriod(DublinCoreValue value)
Like
decodePeriod(String), but throws an IllegalArgumentException if the value cannot be decoded. |
static DCMIPeriod |
decodeMandatoryPeriod(String value)
Like
decodePeriod(DublinCoreValue), but throws an IllegalArgumentException if the value cannot be
decoded. |
static Temporal |
decodeMandatoryTemporal(DublinCoreValue value)
Like
decodeTemporal(DublinCoreValue), but throws an IllegalArgumentException if the value cannot
be decoded. |
static DCMIPeriod |
decodePeriod(DublinCoreValue value)
Tries to decode a string in the DCMI period format, using W3C-DTF for the encoding of the individual dates.
|
static DCMIPeriod |
decodePeriod(String value)
Tries to decode a string in the DCMI period format, using W3C-DTF for the encoding of the individual dates.
|
static Temporal |
decodeTemporal(DublinCoreValue value)
Tries to decode the value to a temporal object.
|
static DublinCoreValue |
encodeDate(Date date,
Precision precision)
Encode a date with the given precision into a Dublin Core string value, using the recommended W3C-DTF scheme.
|
static DublinCoreValue |
encodeDuration(long duration)
Encode a duration measured in milliseconds into a Dublin Core string using the
DublinCore.ENC_SCHEME_ISO8601 encoding scheme PTnHnMnS. |
static DublinCoreValue |
encodePeriod(DCMIPeriod period,
Precision precision)
Encode a period with the given precision into a Dublin Core string value using the recommended DCMI Period scheme.
|
static String |
formatDate(Date date,
Precision precision) |
public static final org.opencastproject.util.data.Function<DublinCoreValue,org.opencastproject.util.data.Option<Date>> dcValueToDate
public static final org.opencastproject.util.data.Function<String,org.opencastproject.util.data.Option<Date>> stringToDate
decodeDate(String) as a function.public static DublinCoreValue encodeDate(Date date, Precision precision)
Precision.Minute to Precision.Fraction. For years,
months and days the local timezone is used instead to ensure that the given date enters the DublinCore as is. If
UTC was used it may happen that you get the previous or next day, month or year respectively
The language of the returned value is DublinCore.LANGUAGE_UNDEFINED.
See http://www.w3.org/TR/NOTE-datetime for more information about W3C-DTF.
date - the date to encodeprecision - the precision to usepublic static DublinCoreValue encodePeriod(DCMIPeriod period, Precision precision)
encodeDate(Date, Precision) for further information.
One of the dates may be null to create an open interval.
The language of the returned value is DublinCore.LANGUAGE_UNDEFINED.
See http://dublincore.org/documents/dcmi-period/ for more information about DCMI Period.
period - the periodprecision - the precisionpublic static DublinCoreValue encodeDuration(long duration)
DublinCore.ENC_SCHEME_ISO8601 encoding scheme PTnHnMnS.
The language of the returned value is DublinCore.LANGUAGE_UNDEFINED.
See ISO8601 Durations for details.
duration - the duration in millisecondspublic static Long decodeDuration(String value)
Also supports the REPLAY legacy format hh:mm:ss.
See ISO8601 Durations for details.
value - the ISO encoded stringpublic static Long decodeDuration(DublinCoreValue value)
value - the Dublin Core valuepublic static Long decodeMandatoryDuration(DublinCoreValue value)
public static Date decodeDate(DublinCoreValue value)
public static Date decodeDate(String value)
public static Date decodeMandatoryDate(DublinCoreValue value)
decodeDate(String), but throws an IllegalArgumentException if the value cannot be decoded.value - the valueIllegalArgumentException - if the value cannot be decodedpublic static Date decodeMandatoryDate(String value)
decodeDate(String), but throws an IllegalArgumentException if the value cannot be decoded.IllegalArgumentException - if the value cannot be decodedpublic static DCMIPeriod decodePeriod(DublinCoreValue value)
public static DCMIPeriod decodePeriod(String value)
public static DCMIPeriod decodeMandatoryPeriod(DublinCoreValue value)
decodePeriod(String), but throws an IllegalArgumentException if the value cannot be decoded.IllegalArgumentException - if the value cannot be decodedpublic static DCMIPeriod decodeMandatoryPeriod(String value)
decodePeriod(DublinCoreValue), but throws an IllegalArgumentException if the value cannot be
decoded.IllegalArgumentException - if the value cannot be decodedpublic static Temporal decodeTemporal(DublinCoreValue value)
Date,
DCMIPeriod and Long for a duration.value - the value to decodepublic static Temporal decodeMandatoryTemporal(DublinCoreValue value)
decodeTemporal(DublinCoreValue), but throws an IllegalArgumentException if the value cannot
be decoded.Date or DCMIPeriodIllegalArgumentException - if the value cannot be decodedCopyright © 2009–2019 Opencast Project. All rights reserved.