Class NumberOutput


  • public final class NumberOutput
    extends java.lang.Object
    Helper class for efficient writing of numeric values

    NOTE: modified from Jackson Core's similar functionality

    • Constructor Summary

      Constructors 
      Constructor Description
      NumberOutput()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static int calcLongStrLength​(long posValue)
      Pre-conditions: posValue is positive, and larger than Integer.MAX_VALUE (about 2 billions).
      private static int outputFullTriplet​(int triplet, char[] buffer, int offset)  
      static int outputInt​(int value, char[] buffer, int offset)  
      private static int outputLeadingTriplet​(int triplet, char[] buffer, int offset)  
      static int outputLong​(long value, char[] buffer, int offset)  
      static java.lang.String toString​(double value)  
      static java.lang.String toString​(float value)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MILLION

        private static int MILLION
      • BILLION

        private static int BILLION
      • TEN_BILLION_L

        private static long TEN_BILLION_L
      • THOUSAND_L

        private static long THOUSAND_L
      • MIN_INT_AS_LONG

        private static long MIN_INT_AS_LONG
      • MAX_INT_AS_LONG

        private static long MAX_INT_AS_LONG
      • SMALLEST_LONG

        private static final java.lang.String SMALLEST_LONG
      • LEADING_TRIPLETS

        private static final char[] LEADING_TRIPLETS
      • FULL_TRIPLETS

        private static final char[] FULL_TRIPLETS
      • FULL_TRIPLETS_B

        private static final byte[] FULL_TRIPLETS_B
    • Constructor Detail

      • NumberOutput

        public NumberOutput()
    • Method Detail

      • outputInt

        public static int outputInt​(int value,
                                    char[] buffer,
                                    int offset)
        Returns:
        Offset within buffer after outputting int
      • outputLong

        public static int outputLong​(long value,
                                     char[] buffer,
                                     int offset)
        Returns:
        Offset within buffer after outputting int
      • toString

        public static java.lang.String toString​(double value)
      • toString

        public static java.lang.String toString​(float value)
      • outputLeadingTriplet

        private static int outputLeadingTriplet​(int triplet,
                                                char[] buffer,
                                                int offset)
      • outputFullTriplet

        private static int outputFullTriplet​(int triplet,
                                             char[] buffer,
                                             int offset)
      • calcLongStrLength

        private static int calcLongStrLength​(long posValue)

        Pre-conditions: posValue is positive, and larger than Integer.MAX_VALUE (about 2 billions).