com.pkrete.jsip2.util
Class MessageUtil

java.lang.Object
  extended by com.pkrete.jsip2.util.MessageUtil

public class MessageUtil
extends Object

This class offers methods that are needed for creating SIP2 messages.

Author:
Petteri Kivimäki

Constructor Summary
MessageUtil()
           
 
Method Summary
static String computeChecksum(String str)
          Computes the checksum of the given string.
static String createFutureDate(int days, int months)
          Creates a new date/time string presented in the SIP2 format "yyyyMMdd HHmmss" by adding the given number of days and months to the current date.
static String getSipDateTime()
          Returns the current date and time in the format used in the SIP2 messages.
static Date parseSipDateTime(String dateStr)
          Parses the date and time from the given SIP2 formatted string.
static String toSipDateTime(Date date)
          Converts the given date to a SIP2 formatted date/time string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageUtil

public MessageUtil()
Method Detail

computeChecksum

public static String computeChecksum(String str)
Computes the checksum of the given string.

Parameters:
str - transmission string
Returns:
checksum of the given string

getSipDateTime

public static String getSipDateTime()
Returns the current date and time in the format used in the SIP2 messages. The SIP2 format is "yyyyMMdd HHmmss".

Returns:
current date and time in SIP2 format

parseSipDateTime

public static Date parseSipDateTime(String dateStr)
Parses the date and time from the given SIP2 formatted string. The SIP2 format is "yyyyMMdd HHmmss".

Parameters:
dateStr - date and time in SIP2 format
Returns:
Date object

toSipDateTime

public static String toSipDateTime(Date date)
Converts the given date to a SIP2 formatted date/time string. The SIP2 format is "yyyyMMdd HHmmss".

Parameters:
date - date object to be converted
Returns:
SIP2 formatted date/time string

createFutureDate

public static String createFutureDate(int days,
                                      int months)
Creates a new date/time string presented in the SIP2 format "yyyyMMdd HHmmss" by adding the given number of days and months to the current date. This method is usefull when setting an expiration date to a hold.

Parameters:
days - number of days to be added to the current date
months - number of months to be added to the current date
Returns:
current date plus the given number of days and months in the SIP2 format "yyyyMMdd HHmmss"


Copyright © 2012-2014. All Rights Reserved.