Skip to content

Commit

Permalink
update Java version
Browse files Browse the repository at this point in the history
  • Loading branch information
peteroupc committed May 27, 2020
1 parent 33db243 commit edaed4c
Show file tree
Hide file tree
Showing 28 changed files with 1,275 additions and 1,092 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ project, add the following to the `dependencies` section in your `pom.xml` file:
<dependency>
<groupId>com.upokecenter</groupId>
<artifactId>cbor</artifactId>
<version>4.1.1</version>
<version>4.1.3</version>
</dependency>
```

Expand Down
6 changes: 4 additions & 2 deletions api/Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Interface implemented by classes that convert objects of arbitrary types to
Classes that implement this interface can support conversions from CBOR
objects to a custom type and back.

* [com.upokecenter.cbor.CBORDataUtilities](com.upokecenter.cbor.CBORDataUtilities.md) -  
* [com.upokecenter.cbor.CBORDataUtilities](com.upokecenter.cbor.CBORDataUtilities.md) -
Contains methods useful for reading and writing data, with a focus on CBOR.

* [com.upokecenter.cbor.CBOREncodeOptions](com.upokecenter.cbor.CBOREncodeOptions.md) -
Specifies options for encoding and decoding CBOR objects.
Expand Down Expand Up @@ -41,7 +42,8 @@ Represents a type that a CBOR object can have.
* [com.upokecenter.cbor.JSONOptions.ConversionMode](com.upokecenter.cbor.JSONOptions.ConversionMode.md) -
Specifies how JSON numbers are converted to CBOR when decoding JSON.

* [com.upokecenter.cbor.CBORException](com.upokecenter.cbor.CBORException.md) -  
* [com.upokecenter.cbor.CBORException](com.upokecenter.cbor.CBORException.md) -
Exception thrown for errors involving CBOR data.

* [com.upokecenter.util.DataUtilities](com.upokecenter.util.DataUtilities.md) -
Contains methods useful for reading and writing text strings.
153 changes: 153 additions & 0 deletions api/com.upokecenter.cbor.CBORDataUtilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

public final class CBORDataUtilities extends java.lang.Object

Contains methods useful for reading and writing data, with a focus on CBOR.

## Methods

* `static CBORObject ParseJSONNumber​(java.lang.String str)`<br>
Parses a number whose format follows the JSON specification.
* `static CBORObject ParseJSONNumber​(java.lang.String str,
boolean integersOnly,
boolean positiveOnly)`<br>
Expand All @@ -25,17 +28,39 @@ Instead, call ParseJSONNumber(str, jsonoptions) with a JSONOptions that
* `static CBORObject ParseJSONNumber​(java.lang.String str,
int offset,
int count)`<br>
Parses a number whose format follows the JSON specification (RFC 8259) from
a portion of a text string, and converts that number to a CBOR
object.
* `static CBORObject ParseJSONNumber​(java.lang.String str,
int offset,
int count,
JSONOptions options)`<br>
Parses a number whose format follows the JSON specification (RFC 8259) and
converts that number to a CBOR object.
* `static CBORObject ParseJSONNumber​(java.lang.String str,
JSONOptions options)`<br>
Parses a number whose format follows the JSON specification (RFC 8259) and
converts that number to a CBOR object.

## Method Details

### ParseJSONNumber
public static CBORObject ParseJSONNumber​(java.lang.String str)
Parses a number whose format follows the JSON specification. The method uses
a JSONOptions with all default properties except for a
PreserveNegativeZero property of false.

**Parameters:**

* <code>str</code> - A text string to parse as a JSON string.

**Returns:**

* A CBOR object that represents the parsed number. Returns positive
zero if the number is a zero that starts with a minus sign (such as
"-0" or "-0.0"). Returns null if the parsing fails, including if the
string is null or empty.

### ParseJSONNumber
@Deprecated public static CBORObject ParseJSONNumber​(java.lang.String str, boolean integersOnly, boolean positiveOnly)
Deprecated.
Expand All @@ -45,6 +70,23 @@ Call the one-argument version of this method instead. If this method
call used integersOnly = true, check that the String does not
contain '.', 'E', or 'e' before calling that version.

**Parameters:**

* <code>str</code> - A text string to parse as a JSON number.

* <code>integersOnly</code> - If true, no decimal points or exponents are allowed in
the string. The default is false.

* <code>positiveOnly</code> - If true, only positive numbers are allowed (the leading
minus is disallowed). The default is false.

**Returns:**

* A CBOR object that represents the parsed number. Returns positive
zero if the number is a zero that starts with a minus sign (such as
"-0" or "-0.0"). Returns null if the parsing fails, including if the
string is null or empty.

### ParseJSONNumber
@Deprecated public static CBORObject ParseJSONNumber​(java.lang.String str, boolean integersOnly, boolean positiveOnly, boolean preserveNegativeZero)
Deprecated.
Expand All @@ -56,9 +98,120 @@ Instead, call ParseJSONNumber(str, jsonoptions) with a JSONOptions that
that the String does not contain '.', 'E',
or 'e' before calling that version.

**Parameters:**

* <code>str</code> - A text string to parse as a JSON number.

* <code>integersOnly</code> - If true, no decimal points or exponents are allowed in
the string. The default is false.

* <code>positiveOnly</code> - If true, the leading minus is disallowed in the string.
The default is false.

* <code>preserveNegativeZero</code> - If true, returns positive zero if the number is
a zero that starts with a minus sign (such as "-0" or "-0.0").
Otherwise, returns negative zero in this case. The default is false.

**Returns:**

* A CBOR object that represents the parsed number. Returns null if the
parsing fails, including if the string is null or empty.

### ParseJSONNumber
public static CBORObject ParseJSONNumber​(java.lang.String str, JSONOptions options)
Parses a number whose format follows the JSON specification (RFC 8259) and
converts that number to a CBOR object.<p>Roughly speaking, a valid
JSON number consists of an optional minus sign, one or more basic
digits (starting with 1 to 9 unless there is only one digit and that
digit is 0), an optional decimal point (".", full stop) with one or
more basic digits, and an optional letter E or e with an optional
plus or minus sign and one or more basic digits (the exponent). A
string representing a valid JSON number is not allowed to contain
white space characters, including spaces.</p>

**Parameters:**

* <code>str</code> - A text string to parse as a JSON number.

* <code>options</code> - An object containing options to control how JSON numbers are
decoded to CBOR objects. Can be null, in which case a JSONOptions
object with all default properties is used instead.

**Returns:**

* A CBOR object that represents the parsed number. Returns null if the
parsing fails, including if the string is null or empty.

### ParseJSONNumber
public static CBORObject ParseJSONNumber​(java.lang.String str, int offset, int count)
Parses a number whose format follows the JSON specification (RFC 8259) from
a portion of a text string, and converts that number to a CBOR
object.<p>Roughly speaking, a valid JSON number consists of an
optional minus sign, one or more basic digits (starting with 1 to 9
unless there is only one digit and that digit is 0), an optional
decimal point (".", full stop) with one or more basic digits, and an
optional letter E or e with an optional plus or minus sign and one
or more basic digits (the exponent). A string representing a valid
JSON number is not allowed to contain white space characters,
including spaces.</p>

**Parameters:**

* <code>str</code> - A text string containing the portion to parse as a JSON number.

* <code>offset</code> - An index, starting at 0, showing where the desired portion of
<code>str</code> begins.

* <code>count</code> - The length, in code units, of the desired portion of <code>
str</code> (but not more than <code>str</code> 's length).

**Returns:**

* A CBOR object that represents the parsed number. Returns null if the
parsing fails, including if the string is null or empty.

**Throws:**

* <code>java.lang.IllegalArgumentException</code> - Either <code>offset</code> or <code>count</code> is less
than 0 or greater than <code>str</code> 's length, or <code>str</code> 's
length minus <code>offset</code> is less than <code>count</code>.

* <code>java.lang.NullPointerException</code> - The parameter <code>str</code> is null.

### ParseJSONNumber
public static CBORObject ParseJSONNumber​(java.lang.String str, int offset, int count, JSONOptions options)
Parses a number whose format follows the JSON specification (RFC 8259) and
converts that number to a CBOR object.<p>Roughly speaking, a valid
JSON number consists of an optional minus sign, one or more basic
digits (starting with 1 to 9 unless there is only one digit and that
digit is 0), an optional decimal point (".", full stop) with one or
more basic digits, and an optional letter E or e with an optional
plus or minus sign and one or more basic digits (the exponent). A
string representing a valid JSON number is not allowed to contain
white space characters, including spaces.</p>

**Parameters:**

* <code>str</code> - A text string to parse as a JSON number.

* <code>offset</code> - An index, starting at 0, showing where the desired portion of
<code>str</code> begins.

* <code>count</code> - The length, in code units, of the desired portion of <code>
str</code> (but not more than <code>str</code> 's length).

* <code>options</code> - An object containing options to control how JSON numbers are
decoded to CBOR objects. Can be null, in which case a JSONOptions
object with all default properties is used instead.

**Returns:**

* A CBOR object that represents the parsed number. Returns null if the
parsing fails, including if the string is null or empty or <code>
count</code> is 0 or less.

**Throws:**

* <code>java.lang.NullPointerException</code> - The parameter <code>str</code> is null.

* <code>java.lang.IllegalArgumentException</code> - Unsupported conversion kind.
34 changes: 28 additions & 6 deletions api/com.upokecenter.cbor.CBORException.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,38 @@

public final class CBORException extends java.lang.RuntimeException

Exception thrown for errors involving CBOR data. <p>This library may throw
exceptions of this type in certain cases, notably when errors occur,
and may supply messages to those exceptions (the message can be
accessed through the <code>Message</code> property in.NET or the
<code>getMessage()</code> method in Java). These messages are intended to be
read by humans to help diagnose the error (or other cause of the
exception); they are not intended to be parsed by computer programs,
and the exact text of the messages may change at any time between
versions of this library.</p>

## Methods

* `CBORException()`<br>
* `CBORException​(java.lang.String message)`<br>
* `CBORException() CBORException`<br>
Initializes a new instance of the CBORException
class.
* `CBORException​(java.lang.String message) CBORException`<br>
Initializes a new instance of the CBORException
class.
* `CBORException​(java.lang.String message,
java.lang.Throwable innerException)`<br>
java.lang.Throwable innerException) CBORException`<br>
Initializes a new instance of the CBORException
class.

## Constructors

* `CBORException()`<br>
* `CBORException​(java.lang.String message)`<br>
* `CBORException() CBORException`<br>
Initializes a new instance of the CBORException
class.
* `CBORException​(java.lang.String message) CBORException`<br>
Initializes a new instance of the CBORException
class.
* `CBORException​(java.lang.String message,
java.lang.Throwable innerException)`<br>
java.lang.Throwable innerException) CBORException`<br>
Initializes a new instance of the CBORException
class.
Loading

0 comments on commit edaed4c

Please sign in to comment.