@@ -1797,59 +1797,59 @@ Converts this CBOR object to an object of an arbitrary type. See the
17971797 denominator and discarding the fractional part of the result, and this
17981798 method throws an exception (currently ArithmeticException, but may change in
17991799 the next major version) if this object expresses infinity or a not-a-number
1800- value.</li ><li >In the.NET version, if the type is a nullable (e.g., < code >
1801- Nullable& ; lt;int& ; gt;</code > or <code >int?</code > , returns <code >null</code > if this CBOR
1802- object is null, or this object's value converted to the nullable's
1803- underlying type, e.g. , <code >int</code > .</li ><li >If the type is an enumeration(
1804- <code >Enum</code >) type and this CBOR object is a text string or an integer,
1805- returns the appropriate enumerated constant. (For example, if < code >MyEnum</ code >
1806- includes an entry for <code >MyValue</code > , this method will return < code >
1807- MyEnum.MyValue</code > if the CBOR object represents <code >"MyValue"</ code > or the
1808- underlying value for <code >MyEnum.MyValue</code > .) < b >Note:</ b > If an integer is
1809- converted to a.NET Enum constant, and that integer is shared by more than
1810- one constant of the same type, it is undefined which constant from among
1811- them is returned. (For example, if < code >MyEnum.Zero = 0</ code > and < code >
1812- MyEnum.Null = 0</code > , converting 0 to <code >MyEnum</code > may return either <code >
1813- MyEnum.Zero</code > or <code >MyEnum.Null</code > .) As a result, .NET Enum types with
1814- constants that share an underlying value should not be passed to this
1815- method.</li ><li >If the type is <code >byte[ ] </code > (a one-dimensional byte array)
1816- and this CBOR object is a byte string, returns a byte array which this CBOR
1817- byte string's data will be copied to. (This method can't be used to encode
1818- CBOR data to a byte array; for that, use the EncodeToBytes method
1819- instead.)</li ><li >If the type is a one-dimensional or multidimensional array
1820- type and this CBOR object is an array, returns an array containing the items
1821- in this CBOR object.</li ><li >If the type is List, ReadOnlyCollection or the
1822- generic or non- generic List, ICollection, Iterable, IReadOnlyCollection, or
1823- IReadOnlyList (or ArrayList, List, Collection, or Iterable in Java), and if
1824- this CBOR object is an array, returns an object conforming to the type,
1825- class, or interface passed to this method, where the object will contain all
1826- items in this CBOR array.</li ><li >If the type is Dictionary,
1827- ReadOnlyDictionary or the generic or non-generic Map or IReadOnlyDictionary
1828- (or HashMap or Map in Java), and if this CBOR object is a map, returns an
1829- object conforming to the type, class, or interface passed to this method,
1830- where the object will contain all keys and values in this CBOR
1831- map.</li ><li >If the type is an enumeration constant ("enum"), and this CBOR
1832- object is an integer or text string, returns the enumeration constant with
1833- the given number or name, respectively. (Enumeration constants made up of
1834- multiple enumeration constants, as allowed by .NET, can only be matched by
1835- number this way.)</li ><li >If the type is <code >java.util.Date</code > (or <code >Date</ code >
1836- in Java) , returns a date/time object if the CBOR object's outermost tag ==
1837- 0 || tag == 1. For tag 1, this method treats the CBOR object as a number of
1838- seconds since the start of 1970, which is based on the POSIX definition of
1839- "seconds since the Epoch", a definition that does not count leap seconds. In
1840- this method, this number of seconds assumes the use of a proleptic Gregorian
1841- calendar, in which the rules regarding the number of days in each month and
1842- which years are leap years are the same for all years as they were in 1970
1843- (including without regard to time zone differences or transitions from other
1844- calendars to the Gregorian). The string format used in tag 0 supports only
1845- years up to 4 decimal digits long. For tag 1, CBOR objects that express
1846- infinity or not-a-number (NaN) are treated as invalid by this method. This
1847- default behavior for <code >java.util.Date</code > and <code >Date</code > can be changed by
1848- passing a suitable CBORTypeMapper to this method, such as a CBORTypeMapper
1849- that registers a CBORDateConverter for <code >java.util.Date</code > or < code >Date</ code >
1850- objects. See the examples.</li ><li >If the type is <code >java.net.URI</code > (or < code >
1851- URI</code > in Java), returns a URI object if possible.</li ><li >If the type is
1852- <code >java.util.UUID</code > (or <code >UUID</code > in Java), returns a UUID object if
1800+ value.</li ><li >In the.NET version, if the type is a nullable (for example,
1801+ < code > Nullable& ; lt;int& ; gt;</code > or <code >int?</code > , returns <code >null</code > if this
1802+ CBOR object is null, or this object's value converted to the nullable's
1803+ underlying type, for example , <code >int</code > .</li ><li >If the type is an
1804+ enumeration ( <code >Enum</code >) type and this CBOR object is a text string or
1805+ an integer, returns the appropriate enumerated constant. (For example, if
1806+ < code >MyEnum</ code > includes an entry for <code >MyValue</code > , this method will
1807+ return < code > MyEnum.MyValue</code > if the CBOR object represents <code >
1808+ "MyValue"</ code > or the underlying value for <code >MyEnum.MyValue</code > .)
1809+ < b >Note:</ b > If an integer is converted to a.NET Enum constant, and that
1810+ integer is shared by more than one constant of the same type, it is
1811+ undefined which constant from among them is returned. (For example, if
1812+ < code > MyEnum.Zero = 0</code > and <code >MyEnum.Null = 0 </code > , converting 0 to <code >
1813+ MyEnum</ code > may return either < code >MyEnum .Zero</code > or <code >MyEnum.Null</code > .) As a
1814+ result, .NET Enum types with constants that share an underlying value should
1815+ not be passed to this method.</li ><li >If the type is <code >byte[ ] </code > (a
1816+ one-dimensional byte array) and this CBOR object is a byte string, returns a
1817+ byte array which this CBOR byte string's data will be copied to. (This
1818+ method can't be used to encode CBOR data to a byte array; for that, use the
1819+ EncodeToBytes method instead.)</li ><li >If the type is a one-dimensional or
1820+ multidimensional array type and this CBOR object is an array, returns an
1821+ array containing the items in this CBOR object.</li ><li >If the type is List,
1822+ ReadOnlyCollection or the generic or nongeneric List, ICollection, Iterable,
1823+ IReadOnlyCollection, or IReadOnlyList (or ArrayList, List, Collection, or
1824+ Iterable in Java), and if this CBOR object is an array, returns an object
1825+ conforming to the type, class, or interface passed to this method, where the
1826+ object will contain all items in this CBOR array.</li ><li >If the type is
1827+ Dictionary, ReadOnlyDictionary or the generic or nongeneric Map or
1828+ IReadOnlyDictionary (or HashMap or Map in Java), and if this CBOR object is
1829+ a map, returns an object conforming to the type, class, or interface passed
1830+ to this method, where the object will contain all keys and values in this
1831+ CBOR map.</li ><li >If the type is an enumeration constant ("enum"), and this
1832+ CBOR object is an integer or text string, returns the enumeration constant
1833+ with the given number or name, respectively. (Enumeration constants made up
1834+ of multiple enumeration constants, as allowed by .NET, can only be matched
1835+ by number this way.)</li ><li >If the type is <code >java.util.Date</code > (or <code >
1836+ Date</ code > in Java) , returns a date/time object if the CBOR object's outermost
1837+ tag == 0 || tag == 1. For tag 1, this method treats the CBOR object as a
1838+ number of seconds since the start of 1970, which is based on the POSIX
1839+ definition of "seconds since the Epoch", a definition that does not count
1840+ leap seconds. In this method, this number of seconds assumes the use of a
1841+ proleptic Gregorian calendar, in which the rules regarding the number of
1842+ days in each month and which years are leap years are the same for all years
1843+ as they were in 1970 (including without regard to time zone differences or
1844+ transitions from other calendars to the Gregorian). The string format used
1845+ in tag 0 supports only years up to 4 decimal digits long. For tag 1, CBOR
1846+ objects that express infinity or not-a-number (NaN) are treated as invalid
1847+ by this method. This default behavior for <code >java.util.Date</code > and <code >Date</code >
1848+ can be changed by passing a suitable CBORTypeMapper to this method, such as
1849+ a CBORTypeMapper that registers a CBORDateConverter for <code >java.util.Date</code > or
1850+ < code >Date</ code > objects. See the examples.</li ><li >If the type is <code >java.net.URI</code >
1851+ (or < code > URI</code > in Java), returns a URI object if possible.</li ><li >If the
1852+ type is <code >java.util.UUID</code > (or <code >UUID</code > in Java), returns a UUID object if
18531853 possible.</li ><li >Plain-Old-Data deserialization: If the object is a type
18541854 not specially handled above, the type includes a zero-parameter constructor
18551855 (default or not), this CBOR object is a CBOR map, and the "mapper" parameter
@@ -2738,7 +2738,7 @@ Generates a CBORObject from an arbitrary object. See the overload of this
27382738 eligible getters.</li ></ul > <p ><b >REMARK:</b > .NET enumeration (<code >
27392739 Enum</code >) constants could also have been converted to text strings with <code >
27402740 toString()</code > , but that method will return multiple names if the given Enum
2741- object is a combination of Enum objects (e.g. if the object is <code >
2741+ object is a combination of Enum objects (for example if the object is <code >
27422742 FileAccess.Read | FileAccess.Write</code >). More generally, if Enums are
27432743 converted to text strings, constants from Enum types with the <code >Flags</code >
27442744 attribute, and constants from the same Enum type that share an underlying
@@ -3993,9 +3993,9 @@ Converts this object to a 64-bit floating-point number if this CBOR object's
39933993
39943994### AsInt32
39953995 public int AsInt32()
3996- <p >Converts this object to a 32-bit signed integer. Non-integer number
3997- values are converted to integers by discarding their fractional parts.
3998- (NOTE: To determine whether this method call can succeed, call
3996+ <p >Converts this object to a 32-bit signed integer. Noninteger number values
3997+ are converted to integers by discarding their fractional parts. (NOTE: To
3998+ determine whether this method call can succeed, call
39993999 <b >AsNumber().getCanTruncatedIntFitInInt32()</b > before calling this method. See
40004000 the example.).</p ><p >The following example code (originally written in C#
40014001 for the.NET Framework) shows a way to check whether a given CBOR object
@@ -4088,16 +4088,15 @@ Converts this object to a java.util.UUID.
40884088 tag).</li ><li >If both objects are arrays, they are compared item by item. In
40894089 this case, if the arrays have different numbers of items, the array with
40904090 more items is treated as greater than the other array.</li ><li >If both
4091- objects are maps, their key-value pairs, sorted by key in accordance with
4092- this method, are compared, where each pair is compared first by key and then
4093- by value. In this case, if the maps have different numbers of key-value
4094- pairs, the map with more pairs is treated as greater than the other
4095- map.</li ><li >If the two objects have different types, the object whose type
4096- comes first in the order of untagged integers, untagged byte strings,
4097- untagged text strings, untagged arrays, untagged maps, tagged objects,
4098- untagged simple values (including True and False) and untagged floating
4099- point values sorts before the other object.</li ></ul > <p >This method is
4100- consistent with the Equals method.</p >
4091+ objects are maps, their key-value pairs, sorted by key per this method, are
4092+ compared, where each pair is compared first by key and then by value. In
4093+ this case, if the maps have different numbers of key-value pairs, the map
4094+ with more pairs is treated as greater than the other map.</li ><li >If the two
4095+ objects have different types, the object whose type comes first in the order
4096+ of untagged integers, untagged byte strings, untagged text strings, untagged
4097+ arrays, untagged maps, tagged objects, untagged simple values (including
4098+ True and False) and untagged floating point values sorts before the other
4099+ object.</li ></ul > <p >This method is consistent with the Equals method.</p >
41014100
41024101** Specified by:**
41034102
@@ -4229,15 +4228,15 @@ Gets the CBOR object referred to by a JSON Pointer according to RFC6901. For
42294228* <code >CBORException</code > - Thrown if the pointer is null, or
42304229 if the pointer is invalid, or if there is no object at the given pointer, or
42314230 the special key "-" appears in the pointer in the context of an array (not a
4232- map), or if the pointer is non-empty and this object has a CBOR type other
4231+ map), or if the pointer is nonempty and this object has a CBOR type other
42334232 than array or map.
42344233
42354234### AtJSONPointer
42364235 public CBORObject AtJSONPointer(String pointer, CBORObject defaultValue)
42374236<p >Gets the CBOR object referred to by a JSON Pointer according to RFC6901,
42384237 or a default value if the operation fails. The syntax for a JSON Pointer is:
42394238 </p ><pre >'/' KEY '/' KEY.get(...)</pre > where KEY represents a key into the
4240- JSON object or its sub-objects in the hierarchy. For example,
4239+ JSON object or its subobjects in the hierarchy. For example,
42414240 <pre >/foo/2/bar</pre > means the same as <pre >obj.get('foo')[2]['bar']</pre >
42424241 in JavaScript. If "~ " and/or "/" occurs in a key, it must be escaped with
42434242 "~ 0" or "~ 1", respectively, in a JSON pointer. JSON pointers also support
@@ -4262,7 +4261,7 @@ Gets the CBOR object referred to by a JSON Pointer according to RFC6901. For
42624261 array or map). Returns <code >defaultValue</code > if the pointer is null, or if
42634262 the pointer is invalid, or if there is no object at the given pointer, or
42644263 the special key "-" appears in the pointer in the context of an array (not a
4265- map), or if the pointer is non-empty and this object has a CBOR type other
4264+ map), or if the pointer is nonempty and this object has a CBOR type other
42664265 than array or map.
42674266
42684267### ApplyJSONPatch
@@ -4767,7 +4766,7 @@ Sets the value of a CBORObject of type Array at the given index to the given
47674766 (JSON) format, using the specified options to control the encoding process.
47684767 This function works not only with arrays and maps, but also integers,
47694768 strings, byte arrays, and other JSON data types. Notes: </p ><ul ><li >If this
4770- object contains maps with non-string keys, the keys are converted to JSON
4769+ object contains maps with nonstring keys, the keys are converted to JSON
47714770 strings before writing the map as a JSON string.</li ><li >If this object
47724771 represents a number (the IsNumber property, or isNumber() method in Java,
47734772 returns true), then it is written out as a number.</li ><li >If the CBOR
@@ -4905,7 +4904,7 @@ try { if (ms != null) { ms.close(); } } catch (java.io.IOException ex) {}
49054904}
49064905} </pre > <p >The
49074906 following example (written in Java for the Java version) shows how to use a
4908- subclassed <code >OutputStream</code > together with a <code >
4907+ subclass of <code >OutputStream</code > together with a <code >
49094908 ByteArrayOutputStream</code > to limit the size of supported JSON serializations of
49104909 CBOR objects.</p > <pre > /* maximum supported JSON size in bytes* / final int
49114910 maxSize = 20000; ByteArrayOutputStream ba = new ByteArrayOutputStream(); /*
@@ -5338,7 +5337,7 @@ finally {
53385337try { if (ms != null) { ms.close(); } } catch (java.io.IOException ex) {}
53395338}
53405339} </pre > <p >The following example (written in Java for the
5341- Java version) shows how to use a subclassed <code >OutputStream</code > together
5340+ Java version) shows how to use a subclass of <code >OutputStream</code > together
53425341 with a <code >ByteArrayOutputStream</code > to limit the size of supported CBOR
53435342 serializations.</p > <pre > /* maximum supported CBOR size in bytes* / final
53445343 int maxSize = 20000; ByteArrayOutputStream ba = new ByteArrayOutputStream();
0 commit comments