public class Utils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.util.regex.Pattern |
datePattern
the date pattern
|
private static java.util.TimeZone |
denicTimeZone
the time zone for date conversions
|
private static char[] |
hexDigits
hex digits
|
Modifier | Constructor and Description |
---|---|
private |
Utils()
private constructor to prevent instantiation
|
Modifier and Type | Method and Description |
---|---|
static byte[] |
calcAuthInfoHash(java.lang.String authInfo)
method that calculates the SHA-256 hash from a given authInfo
|
static java.lang.String |
formatDate(java.util.Date date)
format the given date as 8 digit year/month/day, as required for
the "create AuthInfo 1" operation.
|
static java.lang.String |
formatDateTime(java.util.Date date)
format the given date as a string, conforming to the DENIC specs.
|
static byte[] |
fromBase64Binary(java.lang.String text)
convert a string conforming to the XML Schema base64Binary syntax to
a sequence of bytes
|
static java.util.Date |
parseDateTime(java.lang.String text)
helper method to parse a date.
|
static java.lang.String |
toBase64Binary(byte[] data)
convert a byte sequence to a string conforming to the XML Schema
base64Binary syntax
|
static java.lang.String |
toHex(byte[] data)
convert the given byte sequence to a hex string
|
private static final java.util.regex.Pattern datePattern
private static final java.util.TimeZone denicTimeZone
private static final char[] hexDigits
public static java.util.Date parseDateTime(java.lang.String text) throws ResponseParseException
null
is
accepted and will result in a null
datetext
- the date in text representation,
may be null
null
if the given text is null
ResponseParseException
- if the input is malformedpublic static java.lang.String formatDateTime(java.util.Date date)
null
date results in a null
.date
- the date to convertpublic static java.lang.String formatDate(java.util.Date date)
date
- the date to convert, may be null
YYYYMMDD
, or
null
if given parameter is also
null
public static java.lang.String toHex(byte[] data)
data
- the binary datapublic static byte[] fromBase64Binary(java.lang.String text)
text
- the textual hexadecimal representation,
may be null
null
if the given text is
also null
java.lang.IllegalArgumentException
- if the string does not conform to the
Base64 encodingpublic static java.lang.String toBase64Binary(byte[] data)
data
- the binary data, may be null
null
if the given data is
also null
public static byte[] calcAuthInfoHash(java.lang.String authInfo)
authInfo
- the AuthInfoCopyright © 2005-2013 Knipp Medien und Kommunikation GmbH