public class GeneralUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static Calendar |
fromISO8601DateTime(String dateTime)
Creates
Calendar instance from an ISO 8601 formatted
string. |
static Date |
getDate(DateFormat format,
String date) |
static long |
getFullSecondsElapsedTimeMillis(long start,
long end) |
static String |
readTextFromResource(String resource) |
static String |
readToEnd(InputStream inputStream) |
static void |
sleep(long milliseconds)
Sleeps the input amount of milliseconds.
|
static String |
toISO8601DateTime(Calendar calendar)
Formats date and time as represented by a calendar instance to an ISO
8601 string.
|
static String |
toRfc1123(Calendar calendar)
Formats date and time as represented by a calendar instance to an TFC
1123 string.
|
public static String readToEnd(InputStream inputStream) throws IOException
inputStream - The stream which content we would like to read.IOException - If there was a problem reading/writing
from/to the streams used during the operation.public static String toISO8601DateTime(Calendar calendar)
calendar - The date and time which we would like to format.public static String toRfc1123(Calendar calendar)
calendar - The date and time which we would like to format.public static Calendar fromISO8601DateTime(String dateTime) throws ParseException
Calendar instance from an ISO 8601 formatted
string.dateTime - An ISO 8601 formatted string.Calendar instance representing the given
date and time.ParseException - If dateTime is not in the ISO
8601 format.public static void sleep(long milliseconds)
milliseconds - The number of milliseconds to sleep.public static Date getDate(DateFormat format, String date)
format - The date format parser.date - The date string in a format matching format.Date represented by the input string.public static long getFullSecondsElapsedTimeMillis(long start,
long end)
start - The start time. (Milliseconds)end - The end time. (Milliseconds).Copyright © 2017. All rights reserved.