Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.knipp.rritoolkit
Class Utils

    java.lang.Object
      de.knipp.rritoolkit.Utils

    public class Utils

extends java.lang.Object

class with some utilities that do not fit elsewhere

Version:
  $Revision: 14936 $
Author:
  Klaus Malorny

Field Summary
`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

Constructor Summary
`private` | `Utils()` private constructor to prevent instantiation

Method Summary
`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

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### datePattern

    private static final java.util.regex.Pattern datePattern

  the date pattern

### denicTimeZone

    private static final java.util.TimeZone denicTimeZone

  the time zone for date conversions

### hexDigits

    private static final char[] hexDigits

  hex digits

Constructor Detail

### Utils

    private Utils()

  private constructor to prevent instantiation

Method Detail

### parseDateTime

    public static java.util.Date parseDateTime(java.lang.String text)
                                        throws ResponseParseException

  helper method to parse a date. As a convience, `null` is accepted and will result in a `null` date

  Parameters:
    `text` - the date in text representation, may be `null`
  Returns:
    the parsed date, or `null` if the given text is `null`
  Throws:
    `ResponseParseException` - if the input is malformed

### formatDateTime

    public static java.lang.String formatDateTime(java.util.Date date)

  format the given date as a string, conforming to the DENIC specs. As a convenience, a `null` date results in a `null`.

  Parameters:
    `date` - the date to convert
  Returns:
    the formatted date

### formatDate

    public 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.

  Parameters:
    `date` - the date to convert, may be `null`
  Returns:
    the date, formatted as `YYYYMMDD`, or `null` if given parameter is also `null`

### toHex

    public static java.lang.String toHex(byte[] data)

  convert the given byte sequence to a hex string

  Parameters:
    `data` - the binary data
  Returns:
    the hex string

### fromBase64Binary

    public static byte[] fromBase64Binary(java.lang.String text)

  convert a string conforming to the XML Schema base64Binary syntax to a sequence of bytes

  Parameters:
    `text` - the textual hexadecimal representation, may be `null`
  Returns:
    array containing the bytes or `null` if the given text is also `null`
  Throws:
    `java.lang.IllegalArgumentException` - if the string does not conform to the Base64 encoding

### toBase64Binary

    public static java.lang.String toBase64Binary(byte[] data)

  convert a byte sequence to a string conforming to the XML Schema base64Binary syntax

  Parameters:
    `data` - the binary data, may be `null`
  Returns:
    the hexadecimal encoded data or `null` if the given data is also `null`

### calcAuthInfoHash

    public static byte[] calcAuthInfoHash(java.lang.String authInfo)

  method that calculates the SHA-256 hash from a given authInfo

  Parameters:
    `authInfo` - the AuthInfo
  Returns:
    the binary hash

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005-2011 Knipp Medien und Kommunikation GmbH