public Serializer writeNumber(Number value) throws IOException {
        if (null == value) return writeNull();

        if (value instanceof Float)
        {
            if (((Float)value).isNaN()) return writeNull();
            if (Float.NEGATIVE_INFINITY == value.floatValue()) return writeNull();
            if (Float.POSITIVE_INFINITY == value.floatValue()) return writeNull();
        }

        if (value instanceof Double)
        {
            if (((Double)value).isNaN()) return writeNull();
            if (Double.NEGATIVE_INFINITY == value.doubleValue()) return writeNull();
            if (Double.POSITIVE_INFINITY == value.doubleValue()) return writeNull();
        }

        writeRawString(value.toString());

        return this;
    }
public Serializer writeNumber ( Number value ) throws IOException { if ( null == value ) return writeNull ( ) ; if ( value instanceof Float ) { if ( ( ( Float ) value ) . isNaN ( ) ) return writeNull ( ) ; if ( Float . NEGATIVE_INFINITY == value . floatValue ( ) ) return writeNull ( ) ; if ( Float . POSITIVE_INFINITY == value . floatValue ( ) ) return writeNull ( ) ; } if ( value instanceof Double ) { if ( ( ( Double ) value ) . isNaN ( ) ) return writeNull ( ) ; if ( Double . NEGATIVE_INFINITY == value . doubleValue ( ) ) return writeNull ( ) ; if ( Double . POSITIVE_INFINITY == value . doubleValue ( ) ) return writeNull ( ) ; } writeRawString ( value . toString ( ) ) ; return this ; }
Method to write a number to the current writer.
@param value The number to write to the JSON output string.
@throws IOException Thrown if an error occurs during write.