public class SimpleDBUtils
extends java.lang.Object
Constructor and Description |
---|
SimpleDBUtils() |
Modifier and Type | Method and Description |
---|---|
static java.util.Date |
decodeDate(java.lang.String value)
Decodes date value from the string representation created using
encodeDate(..) function.
|
static float |
decodeRealNumberRangeFloat(java.lang.String value,
int maxDigitsRight,
int offsetValue)
Decodes float value from the string representation that was created by
using encodeRealNumberRange(..) function.
|
static int |
decodeRealNumberRangeInt(java.lang.String value,
int offsetValue)
Decodes integer value from the string representation that was created by
using encodeRealNumberRange(..) function.
|
static long |
decodeRealNumberRangeLong(java.lang.String value,
long offsetValue)
Decodes a long value from the string representation that was created by
using encodeRealNumberRange(..) function.
|
static float |
decodeZeroPaddingFloat(java.lang.String value)
Decodes zero-padded positive float value from the string representation
|
static int |
decodeZeroPaddingInt(java.lang.String value)
Decodes zero-padded positive integer value from the string representation
|
static long |
decodeZeroPaddingLong(java.lang.String value)
Decodes a zero-padded positive long value from the string representation
|
static java.lang.String |
encodeDate(java.util.Date date)
Encodes date value into string format that can be compared
lexicographically
|
static java.lang.String |
encodeRealNumberRange(float number,
int maxDigitsLeft,
int maxDigitsRight,
int offsetValue)
Encodes real float value into a string by offsetting and zero-padding
number up to the specified number of digits.
|
static java.lang.String |
encodeRealNumberRange(int number,
int maxNumDigits,
int offsetValue)
Encodes real integer value into a string by offsetting and zero-padding
number up to the specified number of digits.
|
static java.lang.String |
encodeRealNumberRange(long number,
int maxNumDigits,
long offsetValue)
Encodes a positive or negative long value into a string by offsetting and
zero-padding the number up to the specified number of digits.
|
static java.lang.String |
encodeZeroPadding(float number,
int maxNumDigits)
Encodes positive float value into a string by zero-padding number up to
the specified number of digits
|
static java.lang.String |
encodeZeroPadding(int number,
int maxNumDigits)
Encodes positive integer value into a string by zero-padding number up to
the specified number of digits.
|
static java.lang.String |
encodeZeroPadding(long number,
int maxNumDigits)
Encodes positive long value into a string by zero-padding the value up to
the specified number of digits.
|
static java.lang.String |
quoteName(java.lang.String name)
Quotes and escapes an attribute name or domain name by wrapping it with
backticks and escaping any backticks inside the name.
|
static java.lang.String |
quoteValue(java.lang.String value)
Quotes and escapes an attribute value by wrapping it with single quotes
and escaping any single quotes inside the value.
|
static java.lang.String |
quoteValues(java.util.Collection<java.lang.String> values)
Quotes and escapes a list of values so that they can be used in a
SimpleDB query.
|
public static java.lang.String encodeZeroPadding(int number, int maxNumDigits)
number
- positive integer to be encodedmaxNumDigits
- maximum number of digits in the largest value in the
data setpublic static java.lang.String encodeZeroPadding(long number, int maxNumDigits)
number
- positive long to be encodedmaxNumDigits
- maximum number of digits in the largest value in the
data setpublic static java.lang.String encodeZeroPadding(float number, int maxNumDigits)
number
- positive float value to be encodedmaxNumDigits
- maximum number of digits preceding the decimal point
in the largest value in the data setpublic static int decodeZeroPaddingInt(java.lang.String value)
value
- zero-padded string representation of the integerpublic static long decodeZeroPaddingLong(java.lang.String value)
value
- zero-padded string representation of the longpublic static float decodeZeroPaddingFloat(java.lang.String value)
value
- zero-padded string representation of the float valuepublic static java.lang.String encodeRealNumberRange(int number, int maxNumDigits, int offsetValue)
number
- integer to be encodedmaxNumDigits
- maximum number of digits in the largest absolute
value in the data setoffsetValue
- offset value, has to be greater than absolute value of
any negative number in the data set.public static java.lang.String encodeRealNumberRange(long number, int maxNumDigits, long offsetValue)
number
- positive or negative long value to be encodedmaxNumDigits
- maximum number of digits in the largest absolute
value in the data setoffsetValue
- offset value, has to be greater than absolute value of
any negative number in the data set.public static java.lang.String encodeRealNumberRange(float number, int maxDigitsLeft, int maxDigitsRight, int offsetValue)
number
- float to be encodedmaxDigitsLeft
- maximum number of digits left of the decimal point
in the largest absolute value in the data setmaxDigitsRight
- maximum number of digits right of the decimal point
in the largest absolute value in the data set, i.e. precisionoffsetValue
- offset value, has to be greater than absolute value of
any negative number in the data set.public static int decodeRealNumberRangeInt(java.lang.String value, int offsetValue)
value
- string representation of the integer valueoffsetValue
- offset value that was used in the original encodingpublic static long decodeRealNumberRangeLong(java.lang.String value, long offsetValue)
value
- string representation of the long valueoffsetValue
- offset value that was used in the original encodingpublic static float decodeRealNumberRangeFloat(java.lang.String value, int maxDigitsRight, int offsetValue)
value
- string representation of the integer valuemaxDigitsRight
- maximum number of digits left of the decimal point
in the largest absolute value in the data set (must be the
same as the one used for encoding).offsetValue
- offset value that was used in the original encodingpublic static java.lang.String encodeDate(java.util.Date date)
date
- date value to be encodedpublic static java.util.Date decodeDate(java.lang.String value) throws java.text.ParseException
value
- string representation of the date valuejava.text.ParseException
public static java.lang.String quoteValues(java.util.Collection<java.lang.String> values)
values
- The collection of attribute values that will be quoted,
escaped, and included in the returned string list.public static java.lang.String quoteValue(java.lang.String value)
value
- The attribute value to quote and escape.public static java.lang.String quoteName(java.lang.String name)
name
- The attribute name or domain name to quote and escape.Copyright © 2018 Amazon Web Services, Inc. All Rights Reserved.