Package org.openrefine.util
Class ParsingUtilities
- java.lang.Object
-
- org.openrefine.util.ParsingUtilities
-
public class ParsingUtilities extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static com.fasterxml.jackson.databind.ser.FilterProviderdefaultFiltersstatic com.fasterxml.jackson.databind.ObjectWriterdefaultWriterstatic DateTimeFormatterISO8601static com.fasterxml.jackson.core.JsonFactoryjsonFactorystatic com.fasterxml.jackson.databind.ObjectMappermapperstatic com.fasterxml.jackson.databind.ser.FilterProvidersaveFiltersstatic com.fasterxml.jackson.databind.ObjectWritersaveWriter
-
Constructor Summary
Constructors Constructor Description ParsingUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static OffsetDateTimecalendarToOffsetDateTime(Calendar calendar)static StringdateToString(OffsetDateTime d)Convert a date/time to an ISO_LOCAL_DATE_TIME stringstatic Stringdecode(String s)Decode a string from UTF-8 encoding.static Stringencode(String s)Encode a string as UTF-8.static com.fasterxml.jackson.databind.node.ArrayNodeevaluateJsonStringToArrayNode(String parameter)static com.fasterxml.jackson.databind.node.ObjectNodeevaluateJsonStringToObjectNode(String optionsString)static StringinputStreamToString(InputStream is)static StringinputStreamToString(InputStream is, String encoding)static booleanisDate(Object o)static StringlocalDateToString(LocalDateTime d)static CalendaroffsetDateTimeToCalendar(OffsetDateTime offsetDateTime)static PropertiesparseParameters(String str)static PropertiesparseParameters(Properties p, String str)static PropertiesparseUrlParameters(javax.servlet.http.HttpServletRequest request)static OffsetDateTimestringToDate(String s)Parse an ISO_LOCAL_DATE_TIME formatted string into a Java Date.static LocalDateTimestringToLocalDate(String s)static OffsetDateTimetoDate(Calendar date)Converts an old-style Java Calendar to an OffsetDateTime, assuming the date is represented in the current default system zone (which is what you get if the date was parsed using `Calendar.getDefault()`).static OffsetDateTimetoDate(Date date)Converts an old-style Java Date to an OffsetDateTime, assuming the date is represented in the current default system zone (which is what you get if the date was parsed using `Calendar.getDefault()`).
-
-
-
Field Detail
-
jsonFactory
public static com.fasterxml.jackson.core.JsonFactory jsonFactory
-
mapper
public static final com.fasterxml.jackson.databind.ObjectMapper mapper
-
defaultFilters
public static final com.fasterxml.jackson.databind.ser.FilterProvider defaultFilters
-
saveFilters
public static final com.fasterxml.jackson.databind.ser.FilterProvider saveFilters
-
saveWriter
public static final com.fasterxml.jackson.databind.ObjectWriter saveWriter
-
defaultWriter
public static final com.fasterxml.jackson.databind.ObjectWriter defaultWriter
-
ISO8601
public static final DateTimeFormatter ISO8601
-
-
Method Detail
-
parseUrlParameters
public static Properties parseUrlParameters(javax.servlet.http.HttpServletRequest request)
-
parseParameters
public static Properties parseParameters(Properties p, String str)
-
parseParameters
public static Properties parseParameters(String str)
-
inputStreamToString
public static String inputStreamToString(InputStream is) throws IOException
- Throws:
IOException
-
inputStreamToString
public static String inputStreamToString(InputStream is, String encoding) throws IOException
- Throws:
IOException
-
dateToString
public static String dateToString(OffsetDateTime d)
Convert a date/time to an ISO_LOCAL_DATE_TIME string- Parameters:
d- the date to be written- Returns:
- string with ISO_LOCAL_DATE_TIME formatted date and time
-
localDateToString
public static String localDateToString(LocalDateTime d)
-
stringToDate
public static OffsetDateTime stringToDate(String s)
Parse an ISO_LOCAL_DATE_TIME formatted string into a Java Date. For backward compatibility, to support the version <= 2.8, cannot use the DateTimeFormatter.ISO_OFFSET_DATE_TIME. Instead, use the ISO8601 below format: yyyy-MM-dd'T'HH:mm:ss'Z'- Parameters:
s- the string to be parsed- Returns:
- LocalDateTime or null if the parse failed
-
stringToLocalDate
public static LocalDateTime stringToLocalDate(String s)
-
calendarToOffsetDateTime
public static OffsetDateTime calendarToOffsetDateTime(Calendar calendar)
-
offsetDateTimeToCalendar
public static Calendar offsetDateTimeToCalendar(OffsetDateTime offsetDateTime)
-
isDate
public static boolean isDate(Object o)
-
toDate
public static OffsetDateTime toDate(Date date)
Converts an old-style Java Date to an OffsetDateTime, assuming the date is represented in the current default system zone (which is what you get if the date was parsed using `Calendar.getDefault()`).
-
toDate
public static OffsetDateTime toDate(Calendar date)
Converts an old-style Java Calendar to an OffsetDateTime, assuming the date is represented in the current default system zone (which is what you get if the date was parsed using `Calendar.getDefault()`).
-
evaluateJsonStringToObjectNode
public static com.fasterxml.jackson.databind.node.ObjectNode evaluateJsonStringToObjectNode(String optionsString)
-
evaluateJsonStringToArrayNode
public static com.fasterxml.jackson.databind.node.ArrayNode evaluateJsonStringToArrayNode(String parameter) throws IOException
- Throws:
IOException
-
-