Class TimeUtil
java.lang.Object
org.apache.beam.runners.dataflow.util.TimeUtil
A helper class for converting between Dataflow API and SDK time representations.
Dataflow API times are strings of the form YYYY-MM-dd'T'HH:mm:ss[.nnnn]'Z'
: that is,
RFC 3339 strings with optional fractional seconds and a 'Z' offset.
Dataflow API durations are strings of the form ['-']sssss[.nnnn]'s'
: that is, seconds
with optional fractional seconds and a literal 's' at the end.
In both formats, fractional seconds are either three digits (millisecond resolution), six digits (microsecond resolution), or nine digits (nanosecond resolution).
-
Method Summary
Modifier and TypeMethodDescriptionfromCloudDuration
(String duration) Converts a Dataflow API duration string into aDuration
.fromCloudTime
(String time) Converts a time value received via the Dataflow API into the correspondingInstant
.static String
toCloudDuration
(ReadableDuration duration) Converts aReadableDuration
into a Dataflow API duration string.static String
toCloudTime
(ReadableInstant instant) Converts aReadableInstant
into a Dataflow API time value.
-
Method Details
-
toCloudTime
Converts aReadableInstant
into a Dataflow API time value. -
fromCloudTime
Converts a time value received via the Dataflow API into the correspondingInstant
.- Returns:
- the parsed time, or null if a parse error occurs
-
toCloudDuration
Converts aReadableDuration
into a Dataflow API duration string. -
fromCloudDuration
Converts a Dataflow API duration string into aDuration
.- Returns:
- the parsed duration, or null if a parse error occurs
-