Package google.registry.rde
Class RdeUtil
- java.lang.Object
-
- google.registry.rde.RdeUtil
-
public final class RdeUtil extends java.lang.Object
Helper methods for RDE.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.joda.time.DateTime
peekWatermark(java.io.BufferedInputStream xmlInput)
Look at some bytes fromxmlInput
to ensure it appears to be a FULL XML deposit and then use a regular expression to extract the watermark timestamp which is returned.static java.lang.String
timestampToId(org.joda.time.ReadableInstant timestamp)
Generates an ID matching the regex\w{1,13}
from a millisecond timestamp.
-
-
-
Method Detail
-
peekWatermark
public static org.joda.time.DateTime peekWatermark(java.io.BufferedInputStream xmlInput) throws java.io.IOException, XmlException
Look at some bytes fromxmlInput
to ensure it appears to be a FULL XML deposit and then use a regular expression to extract the watermark timestamp which is returned.- Throws:
java.io.IOException
XmlException
-
timestampToId
public static java.lang.String timestampToId(org.joda.time.ReadableInstant timestamp)
Generates an ID matching the regex\w{1,13}
from a millisecond timestamp.This routine works by turning the number of UTC milliseconds from the UNIX epoch into a big-endian byte-array which is then converted to a base32 string without padding that's no longer than 13 chars because
13 = Ceiling[Log[32, 2^64]]
. How lucky!
-
-