| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private static final byte | |
| private static final byte | |
| private static final byte | |
| pack-priv static final char[] | |
| pack-priv static final char[] | |
| public static final int | MAX_DOUBLE_CLEN
Maximum number of characters in a serialized double is 26 (at least for Sun JDK; 19 digits for mantissa, 3 for exponent, signs for mantissa and exponent, decimal point, 'E'): but let's pad it up a little bit just to play it safe. |
| public static final int | MAX_FLOAT_CLEN
JDK serializes floats same way as doubles, so let's reserve as much space |
| private static long | |
| public static final int | MAX_INT_CLEN
Maximum number of characters in a serialized integer is 11; one for (minus) sign, and then up to 10 digits |
| public static final int | MAX_LONG_CLEN
Maximum number of characters in a serialized long is 21; one for (minus) sign, and then up to 20 digits |
| private static final int | |
| private static long | MIN_INT_AS_LONG
Note we'll increase value since Integer.MIN_VALUE can not actually be output using simple int-serialization mechanism (since its negation does not fit in 32-bit signed int range) |
| private static final char | |
| private static final long | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static int | calcLongStrLength(long posValue)
Pre-conditions: posValue is positive, and larger than Integer.MAX_VALUE (about 2 billions). |
| private static int | |
| private static int | |
| public static int | |
| public static int | |
| public static int | |
| public static int | |
| private static int | |
| private static int | |
| public static int | Returns: Offset within buffer after outputting intNote caller must ensure that there is room for least 11 characters (leading sign, and up to 10 digits) in buffer passed. |
| public static int | |
| private static int | |
| private static int | |
| public static int | Returns: Offset within buffer after outputting intNote caller must ensure that there is room for least 21 characters (leading sign, and up to 20 digits ) in buffer passed. |
| public static int |
| BILLION | back to summary |
|---|---|
| private static final int BILLION | |
| BYTE_1 | back to summary |
|---|---|
| private static final byte BYTE_1 | |
| BYTE_2 | back to summary |
|---|---|
| private static final byte BYTE_2 | |
| BYTE_HYPHEN | back to summary |
|---|---|
| private static final byte BYTE_HYPHEN | |
| FULL_TRIPLETS | back to summary |
|---|---|
| pack-priv static final char[] FULL_TRIPLETS | |
| LEADING_TRIPLETS | back to summary |
|---|---|
| pack-priv static final char[] LEADING_TRIPLETS | |
| MAX_DOUBLE_CLEN | back to summary |
|---|---|
| public static final int MAX_DOUBLE_CLEN Maximum number of characters in a serialized double is 26 (at least for Sun JDK; 19 digits for mantissa, 3 for exponent, signs for mantissa and exponent, decimal point, 'E'): but let's pad it up a little bit just to play it safe. | |
| MAX_FLOAT_CLEN | back to summary |
|---|---|
| public static final int MAX_FLOAT_CLEN JDK serializes floats same way as doubles, so let's reserve as much space | |
| MAX_INT_AS_LONG | back to summary |
|---|---|
| private static long MAX_INT_AS_LONG | |
| MAX_INT_CLEN | back to summary |
|---|---|
| public static final int MAX_INT_CLEN Maximum number of characters in a serialized integer is 11; one for (minus) sign, and then up to 10 digits | |
| MAX_LONG_CLEN | back to summary |
|---|---|
| public static final int MAX_LONG_CLEN Maximum number of characters in a serialized long is 21; one for (minus) sign, and then up to 20 digits | |
| MILLION | back to summary |
|---|---|
| private static final int MILLION | |
| MIN_INT_AS_LONG | back to summary |
|---|---|
| private static long MIN_INT_AS_LONG Note we'll increase value since Integer.MIN_VALUE can not actually be output using simple int-serialization mechanism (since its negation does not fit in 32-bit signed int range) | |
| NULL_CHAR | back to summary |
|---|---|
| private static final char NULL_CHAR | |
| TEN_BILLION_L | back to summary |
|---|---|
| private static final long TEN_BILLION_L | |
| THOUSAND_L | back to summary |
|---|---|
| private static final long THOUSAND_L | |
| NumberUtil | back to summary |
|---|---|
| public NumberUtil() | |
| calcLongStrLength | back to summary |
|---|---|
| private static int calcLongStrLength(long posValue) Pre-conditions: posValue is positive, and larger than Integer.MAX_VALUE (about 2 billions). | |
| getAsciiBytes | back to summary |
|---|---|
| private static int getAsciiBytes(String str, byte[] buffer, int ptr) | |
| getChars | back to summary |
|---|---|
| private static int getChars(String str, char[] buffer, int ptr) | |
| writeDouble | back to summary |
|---|---|
| public static int writeDouble(double value, char[] buffer, int offset) | |
| writeDouble | back to summary |
|---|---|
| public static int writeDouble(double value, byte[] buffer, int offset) | |
| writeFloat | back to summary |
|---|---|
| public static int writeFloat(float value, char[] buffer, int offset) | |
| writeFloat | back to summary |
|---|---|
| public static int writeFloat(float value, byte[] buffer, int offset) | |
| writeFullTriplet | back to summary |
|---|---|
| private static int writeFullTriplet(int triplet, char[] buffer, int offset) | |
| writeFullTriplet | back to summary |
|---|---|
| private static int writeFullTriplet(int triplet, byte[] buffer, int offset) | |
| writeInt | back to summary |
|---|---|
| public static int writeInt(int value, char[] buffer, int offset) Note caller must ensure that there is room for least 11 characters (leading sign, and up to 10 digits) in buffer passed.
| |
| writeInt | back to summary |
|---|---|
| public static int writeInt(int value, byte[] buffer, int offset) | |
| writeLeadingTriplet | back to summary |
|---|---|
| private static int writeLeadingTriplet(int triplet, char[] buffer, int offset) | |
| writeLeadingTriplet | back to summary |
|---|---|
| private static int writeLeadingTriplet(int triplet, byte[] buffer, int offset) | |
| writeLong | back to summary |
|---|---|
| public static int writeLong(long value, char[] buffer, int offset) Note caller must ensure that there is room for least 21 characters (leading sign, and up to 20 digits ) in buffer passed.
| |
| writeLong | back to summary |
|---|---|
| public static int writeLong(long value, byte[] buffer, int offset) | |