22
33 public final class CBORDataUtilities extends java.lang.Object
44
5- Contains methods useful for reading and writing data, with a focus on CBOR.
6-
75## Methods
86
97* ` static CBORObject ParseJSONNumber(java.lang.String str) ` <br >
10- Parses a number whose format follows the JSON specification.
118* `static CBORObject ParseJSONNumber(java.lang.String str,
129 boolean integersOnly,
1310 boolean positiveOnly)`<br >
@@ -28,39 +25,17 @@ Instead, call ParseJSONNumber(str, jsonoptions) with a JSONOptions that
2825* `static CBORObject ParseJSONNumber(java.lang.String str,
2926 int offset,
3027 int count)`<br >
31- Parses a number whose format follows the JSON specification (RFC 8259) from
32- a portion of a text string, and converts that number to a CBOR
33- object.
3428* `static CBORObject ParseJSONNumber(java.lang.String str,
3529 int offset,
3630 int count,
3731 JSONOptions options)`<br >
38- Parses a number whose format follows the JSON specification (RFC 8259) and
39- converts that number to a CBOR object.
4032* `static CBORObject ParseJSONNumber(java.lang.String str,
4133 JSONOptions options)`<br >
42- Parses a number whose format follows the JSON specification (RFC 8259) and
43- converts that number to a CBOR object.
4434
4535## Method Details
4636
4737### ParseJSONNumber
4838 public static CBORObject ParseJSONNumber(java.lang.String str)
49- Parses a number whose format follows the JSON specification. The method uses
50- a JSONOptions with all default properties except for a
51- PreserveNegativeZero property of false.
52-
53- ** Parameters:**
54-
55- * <code >str</code > - A text string to parse as a JSON string.
56-
57- ** Returns:**
58-
59- * A CBOR object that represents the parsed number. Returns positive
60- zero if the number is a zero that starts with a minus sign (such as
61- "-0" or "-0.0"). Returns null if the parsing fails, including if the
62- string is null or empty.
63-
6439### ParseJSONNumber
6540 @Deprecated public static CBORObject ParseJSONNumber(java.lang.String str, boolean integersOnly, boolean positiveOnly)
6641Deprecated.
@@ -70,23 +45,6 @@ Call the one-argument version of this method instead. If this method
7045 call used integersOnly = true, check that the String does not
7146 contain '.', 'E', or 'e' before calling that version.
7247
73- ** Parameters:**
74-
75- * <code >str</code > - A text string to parse as a JSON number.
76-
77- * <code >integersOnly</code > - If true, no decimal points or exponents are allowed in
78- the string. The default is false.
79-
80- * <code >positiveOnly</code > - If true, only positive numbers are allowed (the leading
81- minus is disallowed). The default is false.
82-
83- ** Returns:**
84-
85- * A CBOR object that represents the parsed number. Returns positive
86- zero if the number is a zero that starts with a minus sign (such as
87- "-0" or "-0.0"). Returns null if the parsing fails, including if the
88- string is null or empty.
89-
9048### ParseJSONNumber
9149 @Deprecated public static CBORObject ParseJSONNumber(java.lang.String str, boolean integersOnly, boolean positiveOnly, boolean preserveNegativeZero)
9250Deprecated.
@@ -98,120 +56,9 @@ Instead, call ParseJSONNumber(str, jsonoptions) with a JSONOptions that
9856 that the String does not contain '.', 'E',
9957 or 'e' before calling that version.
10058
101- ** Parameters:**
102-
103- * <code >str</code > - A text string to parse as a JSON number.
104-
105- * <code >integersOnly</code > - If true, no decimal points or exponents are allowed in
106- the string. The default is false.
107-
108- * <code >positiveOnly</code > - If true, the leading minus is disallowed in the string.
109- The default is false.
110-
111- * <code >preserveNegativeZero</code > - If true, returns positive zero if the number is
112- a zero that starts with a minus sign (such as "-0" or "-0.0").
113- Otherwise, returns negative zero in this case. The default is false.
114-
115- ** Returns:**
116-
117- * A CBOR object that represents the parsed number. Returns null if the
118- parsing fails, including if the string is null or empty.
119-
12059### ParseJSONNumber
12160 public static CBORObject ParseJSONNumber(java.lang.String str, JSONOptions options)
122- Parses a number whose format follows the JSON specification (RFC 8259) and
123- converts that number to a CBOR object.<p >Roughly speaking, a valid
124- JSON number consists of an optional minus sign, one or more basic
125- digits (starting with 1 to 9 unless there is only one digit and that
126- digit is 0), an optional decimal point (".", full stop) with one or
127- more basic digits, and an optional letter E or e with an optional
128- plus or minus sign and one or more basic digits (the exponent). A
129- string representing a valid JSON number is not allowed to contain
130- white space characters, including spaces.</p >
131-
132- ** Parameters:**
133-
134- * <code >str</code > - A text string to parse as a JSON number.
135-
136- * <code >options</code > - An object containing options to control how JSON numbers are
137- decoded to CBOR objects. Can be null, in which case a JSONOptions
138- object with all default properties is used instead.
139-
140- ** Returns:**
141-
142- * A CBOR object that represents the parsed number. Returns null if the
143- parsing fails, including if the string is null or empty.
144-
14561### ParseJSONNumber
14662 public static CBORObject ParseJSONNumber(java.lang.String str, int offset, int count)
147- Parses a number whose format follows the JSON specification (RFC 8259) from
148- a portion of a text string, and converts that number to a CBOR
149- object.<p >Roughly speaking, a valid JSON number consists of an
150- optional minus sign, one or more basic digits (starting with 1 to 9
151- unless there is only one digit and that digit is 0), an optional
152- decimal point (".", full stop) with one or more basic digits, and an
153- optional letter E or e with an optional plus or minus sign and one
154- or more basic digits (the exponent). A string representing a valid
155- JSON number is not allowed to contain white space characters,
156- including spaces.</p >
157-
158- ** Parameters:**
159-
160- * <code >str</code > - A text string containing the portion to parse as a JSON number.
161-
162- * <code >offset</code > - An index, starting at 0, showing where the desired portion of
163- <code >str</code > begins.
164-
165- * <code >count</code > - The length, in code units, of the desired portion of <code >
166- str</code > (but not more than <code >str</code > 's length).
167-
168- ** Returns:**
169-
170- * A CBOR object that represents the parsed number. Returns null if the
171- parsing fails, including if the string is null or empty.
172-
173- ** Throws:**
174-
175- * <code >java.lang.IllegalArgumentException</code > - Either <code >offset</code > or <code >count</code > is less
176- than 0 or greater than <code >str</code > 's length, or <code >str</code > 's
177- length minus <code >offset</code > is less than <code >count</code >.
178-
179- * <code >java.lang.NullPointerException</code > - The parameter <code >str</code > is null.
180-
18163### ParseJSONNumber
18264 public static CBORObject ParseJSONNumber(java.lang.String str, int offset, int count, JSONOptions options)
183- Parses a number whose format follows the JSON specification (RFC 8259) and
184- converts that number to a CBOR object.<p >Roughly speaking, a valid
185- JSON number consists of an optional minus sign, one or more basic
186- digits (starting with 1 to 9 unless there is only one digit and that
187- digit is 0), an optional decimal point (".", full stop) with one or
188- more basic digits, and an optional letter E or e with an optional
189- plus or minus sign and one or more basic digits (the exponent). A
190- string representing a valid JSON number is not allowed to contain
191- white space characters, including spaces.</p >
192-
193- ** Parameters:**
194-
195- * <code >str</code > - A text string to parse as a JSON number.
196-
197- * <code >offset</code > - An index, starting at 0, showing where the desired portion of
198- <code >str</code > begins.
199-
200- * <code >count</code > - The length, in code units, of the desired portion of <code >
201- str</code > (but not more than <code >str</code > 's length).
202-
203- * <code >options</code > - An object containing options to control how JSON numbers are
204- decoded to CBOR objects. Can be null, in which case a JSONOptions
205- object with all default properties is used instead.
206-
207- ** Returns:**
208-
209- * A CBOR object that represents the parsed number. Returns null if the
210- parsing fails, including if the string is null or empty or <code >
211- count</code > is 0 or less.
212-
213- ** Throws:**
214-
215- * <code >java.lang.NullPointerException</code > - The parameter <code >str</code > is null.
216-
217- * <code >java.lang.IllegalArgumentException</code > - Unsupported conversion kind.
0 commit comments