Skip to content

Commit

Permalink
remove char array support
Browse files Browse the repository at this point in the history
  • Loading branch information
pjfanning committed Apr 28, 2022
1 parent cccf8a2 commit 893cc37
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 198 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/fasterxml/jackson/core/io/NumberInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public static double parseAsDouble(final String s, final double def)
/**
* @param s a string representing a number to parse
* @param def the default to return if `s` is not a parseable number
* @param useFastParser whether to use {@link com.fasterxml.jackson.core.io.doubleparser.FastDoubleParser#parseDouble(CharSequence)}
* @param useFastParser whether to use {@link com.fasterxml.jackson.core.io.doubleparser}
* @return closest matching double (or `def` if there is an issue with `s`)
* @since 2.14
*/
Expand Down Expand Up @@ -339,7 +339,7 @@ public static double parseDouble(final String s) throws NumberFormatException {

/**
* @param s a string representing a number to parse
* @param useFastParser whether to use {@link com.fasterxml.jackson.core.io.doubleparser.FastDoubleParser#parseDouble(CharSequence)}
* @param useFastParser whether to use {@link com.fasterxml.jackson.core.io.doubleparser}
* @return closest matching double
* @throws NumberFormatException if string cannot be represented by a double
* @since v2.14
Expand All @@ -361,7 +361,7 @@ public static float parseFloat(final String s) throws NumberFormatException {

/**
* @param s a string representing a number to parse
* @param useFastParser whether to use {@link com.fasterxml.jackson.core.io.doubleparser.FastFloatParser#parseFloat(CharSequence)}
* @param useFastParser whether to use {@link com.fasterxml.jackson.core.io.doubleparser}
* @return closest matching float
* @throws NumberFormatException if string cannot be represented by a float
* @since v2.14
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
*/
public final class DoubleFromCharSequence extends AbstractFloatValueFromCharSequence {

static DoubleFromCharSequence INSTANCE = new DoubleFromCharSequence();

public DoubleFromCharSequence() {
private DoubleFromCharSequence() {

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,7 @@ public static double parseDouble(CharSequence str) throws NumberFormatException
* @throws NumberFormatException if the string can not be parsed
*/
public static double parseDouble(CharSequence str, int offset, int length) throws NumberFormatException {
return new DoubleFromCharSequence().parseDouble(str, offset, length);
}

/**
* Convenience method for calling {@link #parseDouble(char[], int, int)}.
*
* @param str the string to be parsed
* @return the parsed double value
* @throws NumberFormatException if the string can not be parsed
*/
public static double parseDouble(char[] str) throws NumberFormatException {
return parseDouble(str, 0, str.length);
}

/**
* Parses a {@code FloatValue} from a {@code byte}-Array and converts it
* into a {@code double} value.
* <p>
* See {@link com.fasterxml.jackson.core.io.doubleparser} for the syntax of {@code FloatValue}.
*
* @param str the string to be parsed, a byte array with characters
* in ISO-8859-1, ASCII or UTF-8 encoding
* @param off The index of the first character to parse
* @param len The number of characters to parse
* @return the parsed double value
* @throws NumberFormatException if the string can not be parsed
*/
public static double parseDouble(char[] str, int off, int len) throws NumberFormatException {
return new DoubleFromCharArray().parseDouble(str, off, len);
return DoubleFromCharSequence.INSTANCE.parseDouble(str, offset, length);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,7 @@ public static float parseFloat(CharSequence str) throws NumberFormatException {
* @throws NumberFormatException if the string can not be parsed
*/
public static float parseFloat(CharSequence str, int offset, int length) throws NumberFormatException {
return new FloatFromCharSequence().parseFloat(str, offset, length);
}

/**
* Convenience method for calling {@link #parseFloat(char[], int, int)}.
*
* @param str the string to be parsed
* @return the parsed float value
* @throws NumberFormatException if the string can not be parsed
*/
public static float parseFloat(char[] str) throws NumberFormatException {
return parseFloat(str, 0, str.length);
}

/**
* Parses a {@code FloatValue} from a {@code byte}-Array and converts it
* into a {@code float} value.
* <p>
* See {@link com.fasterxml.jackson.core.io.doubleparser} for the syntax of {@code FloatValue}.
*
* @param str the string to be parsed, a byte array with characters
* in ISO-8859-1, ASCII or UTF-8 encoding
* @param off The index of the first character to parse
* @param len The number of characters to parse
* @return the parsed float value
* @throws NumberFormatException if the string can not be parsed
*/
public static float parseFloat(char[] str, int off, int len) throws NumberFormatException {
return new FloatFromCharArray().parseFloat(str, off, len);
return FloatFromCharSequence.INSTANCE.parseFloat(str, offset, length);
}

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
/**
* Parses a {@code float} from a {@link CharSequence}.
*/
public class FloatFromCharSequence extends AbstractFloatValueFromCharSequence {
final class FloatFromCharSequence extends AbstractFloatValueFromCharSequence {

final static FloatFromCharSequence INSTANCE = new FloatFromCharSequence();

public FloatFromCharSequence() {
private FloatFromCharSequence() {

}

Expand Down

0 comments on commit 893cc37

Please sign in to comment.