org.red5.server.util
Class PropertyConverter

java.lang.Object
  extended by org.red5.server.util.PropertyConverter

public class PropertyConverter
extends Object

Converter for properties originating from properties files. Predetermined string formats are converted into other usable types such as timestamps.

Author:
Paul Gregoire ([email protected])

Constructor Summary
PropertyConverter()
           
 
Method Summary
static Integer convertMillisToSeconds(Long millis)
          Quick time converter to keep our timestamps compatible with PHP's time() (seconds)
static long convertStringToFutureTimeMillis(String time)
          Converts a string denoting an amount of time into milliseconds and adds it to the current date.
static int convertStringToMemorySizeInt(String memSize)
          Converts a string denoting an amount of bytes into an integer value.
static long convertStringToMemorySizeLong(String memSize)
          Converts a string denoting an amount of bytes into an long value.
static long convertStringToTimeMillis(String time)
          Converts a string denoting an amount of time into milliseconds.
static int convertStringToTimeSeconds(String time)
          Converts a string denoting an amount of time into seconds.
static Integer getCurrentTimeSeconds()
          Quick time converter to keep our timestamps compatible with PHP's time() (seconds)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyConverter

public PropertyConverter()
Method Detail

convertStringToFutureTimeMillis

public static long convertStringToFutureTimeMillis(String time)
Converts a string denoting an amount of time into milliseconds and adds it to the current date. Strings are expected to follow this form where # equals a digit: #M The following are permitted for denoting time: H = hours, M = minutes, S = seconds

Parameters:
time - time
Returns:
time in milliseconds

convertStringToTimeSeconds

public static int convertStringToTimeSeconds(String time)
Converts a string denoting an amount of time into seconds. Strings are expected to follow this form where # equals a digit: #M The following are permitted for denoting time: H = hours, M = minutes, S = seconds

Parameters:
time - time
Returns:
time in seconds

convertStringToTimeMillis

public static long convertStringToTimeMillis(String time)
Converts a string denoting an amount of time into milliseconds. Strings are expected to follow this form where # equals a digit: #M The following are permitted for denoting time: H = hours, M = minutes, S = seconds

Parameters:
time - time
Returns:
time in milliseconds

convertStringToMemorySizeInt

public static int convertStringToMemorySizeInt(String memSize)
Converts a string denoting an amount of bytes into an integer value. Strings are expected to follow this form where # equals a digit: #M The following are permitted for denoting binary size: K = kilobytes, M = megabytes, G = gigabytes

Parameters:
memSize - memory
Returns:
size as an integer

convertStringToMemorySizeLong

public static long convertStringToMemorySizeLong(String memSize)
Converts a string denoting an amount of bytes into an long value. Strings are expected to follow this form where # equals a digit: #M The following are permitted for denoting binary size: K = kilobytes, M = megabytes, G = gigabytes

Parameters:
memSize - memory size
Returns:
size as an long

getCurrentTimeSeconds

public static Integer getCurrentTimeSeconds()
Quick time converter to keep our timestamps compatible with PHP's time() (seconds)

Returns:
time in seconds

convertMillisToSeconds

public static Integer convertMillisToSeconds(Long millis)
Quick time converter to keep our timestamps compatible with PHP's time() (seconds)

Parameters:
millis - milliseconds
Returns:
seconds


Copyright © 2006-2012 The Red5 Project