Class NumberOutput

java.lang.Object
tools.jackson.core.io.NumberOutput

public final class NumberOutput extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static int
     
    private static long
     
    private static long
     
    private static int
     
    private static long
     
    (package private) static final String
     
    (package private) static final String
     
    private static final int[]
    Encoded representations of 3-decimal-digit indexed values, where 3 LSB are ascii characters
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static int
    _full3(int t, byte[] b, int off)
     
    private static int
    _full3(int t, char[] b, int off)
     
    private static int
    _leading3(int t, byte[] b, int off)
     
    private static int
    _leading3(int t, char[] b, int off)
     
    private static int
    _outputFullBillion(int v, byte[] b, int off)
     
    private static int
    _outputFullBillion(int v, char[] b, int off)
     
    private static int
    _outputSmallestI(byte[] b, int off)
     
    private static int
    _outputSmallestI(char[] b, int off)
     
    private static int
    _outputSmallestL(byte[] b, int off)
     
    private static int
    _outputSmallestL(char[] b, int off)
     
    private static int
    _outputUptoBillion(int v, byte[] b, int off)
     
    private static int
    _outputUptoBillion(int v, char[] b, int off)
     
    private static int
    _outputUptoMillion(byte[] b, int off, int thousands, int ones)
     
    private static int
    _outputUptoMillion(char[] b, int off, int thousands, int ones)
     
    static int
    divBy1000(int number)
    Optimized code for integer division by 1000; typically 50% higher throughput for calculation
    static boolean
    notFinite(double value)
    Helper method to verify whether given double value is finite (regular rational number} or not (NaN or Infinity).
    static boolean
    notFinite(float value)
    Helper method to verify whether given float value is finite (regular rational number} or not (NaN or Infinity).
    static int
    outputInt(int v, byte[] b, int off)
     
    static int
    outputInt(int v, char[] b, int off)
    Method for appending value of given int value into specified char[].
    static int
    outputLong(long v, byte[] b, int off)
     
    static int
    outputLong(long v, char[] b, int off)
    Method for appending value of given long value into specified char[].
    static String
    toString(double v)
     
    static String
    toString(double v, boolean useFastWriter)
     
    static String
    toString(float v)
     
    static String
    toString(float v, boolean useFastWriter)
     

    Methods inherited from class Object

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

    • MILLION

      private static int MILLION
    • BILLION

      private static int BILLION
    • BILLION_L

      private static long BILLION_L
    • MIN_INT_AS_LONG

      private static long MIN_INT_AS_LONG
    • MAX_INT_AS_LONG

      private static long MAX_INT_AS_LONG
    • SMALLEST_INT

      static final String SMALLEST_INT
    • SMALLEST_LONG

      static final String SMALLEST_LONG
    • TRIPLET_TO_CHARS

      private static final int[] TRIPLET_TO_CHARS
      Encoded representations of 3-decimal-digit indexed values, where 3 LSB are ascii characters
  • Constructor Details

    • NumberOutput

      public NumberOutput()
  • Method Details

    • outputInt

      public static int outputInt(int v, char[] b, int off)
      Method for appending value of given int value into specified char[].

      NOTE: caller must guarantee that the output buffer has enough room for String representation of the value.

      Parameters:
      v - Value to append to buffer
      b - Buffer to append value to: caller must guarantee there is enough room
      off - Offset within output buffer (b) to append number at
      Returns:
      Offset within buffer after outputting int
    • outputInt

      public static int outputInt(int v, byte[] b, int off)
    • outputLong

      public static int outputLong(long v, char[] b, int off)
      Method for appending value of given long value into specified char[].

      NOTE: caller must guarantee that the output buffer has enough room for String representation of the value.

      Parameters:
      v - Value to append to buffer
      b - Buffer to append value to: caller must guarantee there is enough room
      off - Offset within output buffer (b) to append number at
      Returns:
      Offset within buffer after outputting long
    • outputLong

      public static int outputLong(long v, byte[] b, int off)
    • divBy1000

      public static int divBy1000(int number)
      Optimized code for integer division by 1000; typically 50% higher throughput for calculation
      Since:
      2.17
    • toString

      public static String toString(double v)
      Parameters:
      v - double
      Returns:
      double as a string
    • toString

      public static String toString(double v, boolean useFastWriter)
      Parameters:
      v - double
      useFastWriter - whether to use Schubfach algorithm to write output (default false)
      Returns:
      double as a string
    • toString

      public static String toString(float v)
      Parameters:
      v - float
      Returns:
      float as a string
    • toString

      public static String toString(float v, boolean useFastWriter)
      Parameters:
      v - float
      useFastWriter - whether to use Schubfach algorithm to write output (default false)
      Returns:
      float as a string
    • notFinite

      public static boolean notFinite(double value)
      Helper method to verify whether given double value is finite (regular rational number} or not (NaN or Infinity).
      Parameters:
      value - double value to check
      Returns:
      True if number is NOT finite (is Infinity or NaN); false otherwise
    • notFinite

      public static boolean notFinite(float value)
      Helper method to verify whether given float value is finite (regular rational number} or not (NaN or Infinity).
      Parameters:
      value - float value to check
      Returns:
      True if number is NOT finite (is Infinity or NaN); false otherwise
    • _outputUptoBillion

      private static int _outputUptoBillion(int v, char[] b, int off)
    • _outputFullBillion

      private static int _outputFullBillion(int v, char[] b, int off)
    • _outputUptoBillion

      private static int _outputUptoBillion(int v, byte[] b, int off)
    • _outputFullBillion

      private static int _outputFullBillion(int v, byte[] b, int off)
    • _outputUptoMillion

      private static int _outputUptoMillion(char[] b, int off, int thousands, int ones)
    • _outputUptoMillion

      private static int _outputUptoMillion(byte[] b, int off, int thousands, int ones)
    • _leading3

      private static int _leading3(int t, char[] b, int off)
    • _leading3

      private static int _leading3(int t, byte[] b, int off)
    • _full3

      private static int _full3(int t, char[] b, int off)
    • _full3

      private static int _full3(int t, byte[] b, int off)
    • _outputSmallestL

      private static int _outputSmallestL(char[] b, int off)
    • _outputSmallestL

      private static int _outputSmallestL(byte[] b, int off)
    • _outputSmallestI

      private static int _outputSmallestI(char[] b, int off)
    • _outputSmallestI

      private static int _outputSmallestI(byte[] b, int off)