From 2b7e76d2d8b1c0329f411f7aedad972f8c19f1b5 Mon Sep 17 00:00:00 2001 From: Peter Occil Date: Thu, 15 Aug 2024 12:53:04 -0400 Subject: [PATCH] Updating GitHub Pages --- ...om.upokecenter.cbor.CBORDataUtilities.html | 140 +- ...om.upokecenter.cbor.CBORDateConverter.html | 7 + CBOR/api/com.upokecenter.cbor.CBORObject.html | 1837 +++++++++-------- .../api/com.upokecenter.cbor.JSONOptions.html | 15 + CBOR/api/com.upokecenter.cbor.PODOptions.html | 23 +- CBOR/docs/PeterO.Cbor.CBORObject.html | 1146 ++-------- CBOR/docs/PeterO.DataUtilities.html | 862 ++++++++ CBOR/index.html | 20 +- sitemap.xml | 18 +- 9 files changed, 2225 insertions(+), 1843 deletions(-) diff --git a/CBOR/api/com.upokecenter.cbor.CBORDataUtilities.html b/CBOR/api/com.upokecenter.cbor.CBORDataUtilities.html index ba1dc085b..b63923542 100644 --- a/CBOR/api/com.upokecenter.cbor.CBORDataUtilities.html +++ b/CBOR/api/com.upokecenter.cbor.CBORDataUtilities.html @@ -77,6 +77,23 @@

Methods

  • static CBORObject ParseJSONNumber(String str, + boolean integersOnly, + boolean positiveOnly)
    + Deprecated. +Call the one-argument version of this method instead.

    +
  • +
  • +

    static CBORObject ParseJSONNumber(String str, + boolean integersOnly, + boolean positiveOnly, + boolean preserveNegativeZero)
    + Deprecated. +Instead, call ParseJSONNumber(str, jsonoptions) with a JSONOptions that + sets preserveNegativeZero to the desired value, either true or + false.

    +
  • +
  • +

    static CBORObject ParseJSONNumber(String str, int offset, int count)
    Parses a number whose format follows the JSON specification (RFC 8259) @@ -102,7 +119,7 @@

    Methods

    Method Details

    ParseJSONNumber

    -
    public static CBORObject ParseJSONNumber(String str) Parses a number whose format follows the JSON specification. The method uses  a JSONOptions with all default properties.
    +
    public static CBORObject ParseJSONNumber(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:

    @@ -113,12 +130,95 @@

    ParseJSONNumber

    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(String str, boolean integersOnly, boolean positiveOnly)
    +
    +

    Parses a number whose format follows the JSON specification (RFC 8259). + The method uses a JSONOptions with all default properties except for a + PreserveNegativeZero property of false.

    +

    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 text string representing a valid JSON + number is not allowed to contain white space characters, including + spaces.

    + +

    Parameters:

    + +
      +
    • +

      str - A text string to parse as a JSON number.

      +
    • +
    • +

      integersOnly - If true, no decimal points or exponents are allowed in + the string. The default is false.

      +
    • +
    • +

      positiveOnly - 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(String str, boolean integersOnly, boolean positiveOnly, boolean preserveNegativeZero)
    +
    +

    Parses a number whose format follows the JSON specification (RFC + 8259).

    +

    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 + text string representing a valid JSON number is not allowed to contain white + space characters, including spaces.

    + +

    Parameters:

    + +
      +
    • +

      str - A text string to parse as a JSON number.

      +
    • +
    • +

      integersOnly - If true, no decimal points or exponents are allowed in + the string. The default is false.

      +
    • +
    • +

      positiveOnly - If true, the leading minus is disallowed in the string. + The default is false.

      +
    • +
    • +

      preserveNegativeZero - 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

    +

    ParseJSONNumber

    public static CBORObject ParseJSONNumber(String str, JSONOptions options)
     

    Parses a number whose format follows the JSON specification (RFC 8259) @@ -152,7 +252,7 @@

    ParseJSONNumber

    parsing fails, including if the string is null or empty.
  • -

    ParseJSONNumber

    +

    ParseJSONNumber

    public static CBORObject ParseJSONNumber(String str, int offset, int count)
     

    Parses a number whose format follows the JSON specification (RFC 8259) @@ -202,7 +302,7 @@

    ParseJSONNumber

    -

    ParseJSONNumber

    +

    ParseJSONNumber

    public static CBORObject ParseJSONNumber(String str, int offset, int count, JSONOptions options)
     

    Parses a number whose format follows the JSON specification (RFC 8259) @@ -256,7 +356,7 @@

    ParseJSONNumber

    -

    ParseJSONNumber

    +

    ParseJSONNumber

    public static CBORObject ParseJSONNumber(byte[] bytes, int offset, int count, JSONOptions options)
     

    Parses a number from a byte sequence whose format follows the JSON @@ -309,7 +409,7 @@

    ParseJSONNumber

    -

    ParseJSONNumber

    +

    ParseJSONNumber

    public static CBORObject ParseJSONNumber(byte[] bytes, JSONOptions options)
     

    Parses a number from a byte sequence whose format follows the JSON @@ -342,7 +442,7 @@

    ParseJSONNumber

    parsing fails, including if the byte sequence is null or empty. -

    ParseJSONNumber

    +

    ParseJSONNumber

    public static CBORObject ParseJSONNumber(byte[] bytes, int offset, int count)
     

    Parses a number whose format follows the JSON specification (RFC 8259) @@ -392,8 +492,8 @@

    ParseJSONNumber

    -

    ParseJSONNumber

    -
    public static CBORObject ParseJSONNumber(byte[] bytes) Parses a number from a byte sequence whose format follows the JSON  specification. The method uses a JSONOptions with all default properties.
    +

    ParseJSONNumber

    +
    public static CBORObject ParseJSONNumber(byte[] bytes) Parses a number from a byte sequence whose format follows the JSON  specification. The method uses a JSONOptions with all default properties  except for a PreserveNegativeZero property of false.
     

    Parameters:

    @@ -405,11 +505,13 @@

    ParseJSONNumber

    Returns:

    -

    ParseJSONNumber

    +

    ParseJSONNumber

    public static CBORObject ParseJSONNumber(char[] chars, int offset, int count, JSONOptions options)
     

    Parses a number from a sequence of char s whose format follows @@ -463,7 +565,7 @@

    ParseJSONNumber

    -

    ParseJSONNumber

    +

    ParseJSONNumber

    public static CBORObject ParseJSONNumber(char[] chars, JSONOptions options)
     

    Parses a number from a sequence of char s whose format follows @@ -497,7 +599,7 @@

    ParseJSONNumber

    parsing fails, including if the sequence of char s is null or empty. -

    ParseJSONNumber

    +

    ParseJSONNumber

    public static CBORObject ParseJSONNumber(char[] chars, int offset, int count)
     

    Parses a number whose format follows the JSON specification (RFC 8259) @@ -547,8 +649,8 @@

    ParseJSONNumber

    -

    ParseJSONNumber

    -
    public static CBORObject ParseJSONNumber(char[] chars) Parses a number from a sequence of <code>char</code> s whose format follows the  JSON specification. The method uses a JSONOptions with all default  properties.
    +

    ParseJSONNumber

    +
    public static CBORObject ParseJSONNumber(char[] chars) Parses a number from a sequence of <code>char</code> s whose format follows the  JSON specification. The method uses a JSONOptions with all default  properties except for a PreserveNegativeZero property of false.
     

    Parameters:

    @@ -560,8 +662,10 @@

    ParseJSONNumber

    Returns:

      -
    • A CBOR object that represents the parsed number. Returns null if the - parsing fails, including if the sequence of char s is null or empty.
    • +
    • 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 sequence of + char s is null or empty.

    Back to CBOR start page.

    diff --git a/CBOR/api/com.upokecenter.cbor.CBORDateConverter.html b/CBOR/api/com.upokecenter.cbor.CBORDateConverter.html index 60e25e118..b410c0bfc 100644 --- a/CBOR/api/com.upokecenter.cbor.CBORDateConverter.html +++ b/CBOR/api/com.upokecenter.cbor.CBORDateConverter.html @@ -202,6 +202,13 @@

    TryGetDateTimeFields

    otherwise. +

    Throws:

    + +
      +
    • NullPointerException - The parameter year or + lesserFields is null, or contains fewer elements than required.
    • +
    +

    DateTimeFieldsToCBORObject

    public CBORObject DateTimeFieldsToCBORObject(int smallYear, int month, int day) Converts a date/time in the form of a year, month, and day to a CBOR object.  The hour, minute, and second are treated as 00:00:00 by this method, and the  time offset is treated as 0 by this method.
     
    diff --git a/CBOR/api/com.upokecenter.cbor.CBORObject.html b/CBOR/api/com.upokecenter.cbor.CBORObject.html index 8b7184fef..88e76f7de 100644 --- a/CBOR/api/com.upokecenter.cbor.CBORObject.html +++ b/CBOR/api/com.upokecenter.cbor.CBORObject.html @@ -26,25 +26,22 @@

    com.upokecenter.cbor.CBORObject

    and strings. The CBORObject.Read method reads a CBOR object from a data stream.

    To and from other objects: The - CBORObject.From.get(Type) method converts many kinds of objects to a CBOR + CBORObject.FromObject method converts many kinds of objects to a CBOR object, including numbers, strings, and arrays and maps of numbers and strings. Methods like AsNumber and AsString convert a CBOR object to different types of object. The CBORObject.ToObject method converts a CBOR object to an object of a given type; for example, a CBOR array to a native ArrayList (or ArrayList in Java), or a CBOR integer - to an int or long. Of these methods, the.NET versions of the - methods CBORObject.FromObject and CBORObject.ToObject are - not compatible with any context that disallows reflection, such as - ahead-of-time compilation or self-contained app deployment.

    -

    To and - from JSON: This class also doubles as a reader and writer of JavaScript - object Notation (JSON). The CBORObject.FromJSONString method converts JSON - in text string form to a CBOR object, and the ToJSONString method converts a - CBOR object to a JSON string. (Note that the conversion from CBOR to JSON is - not always without loss and may make it impossible to recover the original - object when converting the JSON back to CBOR. See the ToJSONString - documentation.) Likewise, ToJSONBytes and FromJSONBytes work with JSON in - the form of byte arrays rather than text strings.

    + to an int or long.

    +

    To and from JSON: This + class also doubles as a reader and writer of JavaScript object Notation + (JSON). The CBORObject.FromJSONString method converts JSON in text string + form to a CBOR object, and the ToJSONString method converts a CBOR object to + a JSON string. (Note that the conversion from CBOR to JSON is not always + without loss and may make it impossible to recover the original object when + converting the JSON back to CBOR. See the ToJSONString documentation.) + Likewise, ToJSONBytes and FromJSONBytes work with JSON in the form of byte + arrays rather than text strings.

    In addition, the CBORObject.WriteJSON method writes many kinds of objects as JSON to a data stream, including numbers, CBOR objects, strings, and arrays of numbers and @@ -135,6 +132,12 @@

    Fields

    Methods

      +
    • +

      CBORObject Abs()
      + Deprecated. +Instead, convert this object to a number (with .getAsNumber()()), + and use that number’s.getAbs()() method.

      +
    • CBORObject Add(CBORObject obj)
      Adds a new object to the end of this array.

      @@ -149,6 +152,13 @@

      Methods

      Object valueOb)
      Adds a new key and its value to this CBOR map, or adds the value if the key doesn’t exist.

      +
    • +
    • +

      static CBORObject Addition(CBORObject first, + CBORObject second)
      + Deprecated. +Instead, convert both CBOR objects to numbers (with .AsNumber()), and + use the first number’s.Add() method.

    • CBORObject ApplyJSONPatch(CBORObject patch)
      @@ -159,6 +169,12 @@

      Methods

      boolean AsBoolean()
      Returns false if this object is a CBOR false, null, or undefined value (whether or not the object has tags); otherwise, true.

      +
    • +
    • +

      byte AsByte()
      + Deprecated. +Instead, use.getToObject()<byte>() in .NET or +.getToObject()(Byte.class) in Java.

    • double AsDouble()
      @@ -173,6 +189,29 @@

      Methods

      double AsDoubleValue()
      Converts this object to a 64-bit floating-point number if this CBOR object’s type is FloatingPoint.

      +
    • +
    • +

      com.upokecenter.numbers.EDecimal AsEDecimal()
      + Deprecated. +Instead, use.getToObject()<PeterO.Numbers.EDecimal>() + in .NET or +.getToObject()(com.upokecenter.numbers.EDecimal.class) + in Java.

      +
    • +
    • +

      com.upokecenter.numbers.EFloat AsEFloat()
      + Deprecated. +Instead, use.getToObject()<PeterO.Numbers.EFloat>() in.NET + or .getToObject()(com.upokecenter.numbers.EFloat.class) + in Java.

      +
    • +
    • +

      com.upokecenter.numbers.EInteger AsEInteger()
      + Deprecated. +Instead, use.getToObject()<PeterO.Numbers.EInteger>() + in .NET or +.getToObject()(com.upokecenter.numbers.EInteger.class) + in Java.

    • com.upokecenter.numbers.EInteger AsEIntegerValue()
      @@ -180,8 +219,17 @@

      Methods

      type is Integer.

    • -

      UUID AsGuid()
      - Converts this object to a java.util.UUID.

      +

      com.upokecenter.numbers.ERational AsERational()
      + Deprecated. +Instead, use.getToObject()<PeterO.Numbers.ERational>() in +.NET or.getToObject()(com.upokecenter.numbers.ERational.class) + in Java.

      +
    • +
    • +

      short AsInt16()
      + Deprecated. +Instead, use the following: (cbor.AsNumber().ToInt16Checked()), + or .getToObject()<short>() in .NET.

    • int AsInt32()
      @@ -191,6 +239,12 @@

      Methods

      int AsInt32Value()
      Converts this object to a 32-bit signed integer if this CBOR object’s type is Integer.

      +
    • +
    • +

      long AsInt64()
      + Deprecated. +Instead, use the following: (cbor.AsNumber().ToInt64Checked()), or +.ToObject<long>() in.NET.

    • long AsInt64Value()
      @@ -223,6 +277,48 @@

      Methods

      long CalcEncodedSize()
      Calculates the number of bytes this CBOR object takes when serialized as a byte array using the EncodeToBytes() method.

      +
    • +
    • +

      boolean CanFitInDouble()
      + Deprecated. +Instead, use the following: (cbor.isNumber() + && cbor.AsNumber().CanFitInDouble()).

      +
    • +
    • +

      boolean CanFitInInt32()
      + Deprecated. +Instead, use.CanValueFitInInt32(), if the application allows only CBOR + integers, or (cbor.isNumber() + &&cbor.AsNumber().CanFitInInt32()), if the application + allows any CBOR Object convertible to an integer.

      +
    • +
    • +

      boolean CanFitInInt64()
      + Deprecated. +Instead, use CanValueFitInInt64(), if the application allows only CBOR + integers, or (cbor.isNumber() + &&cbor.AsNumber().CanFitInInt64()), if the application + allows any CBOR Object convertible to an integer.

      +
    • +
    • +

      boolean CanFitInSingle()
      + Deprecated. +Instead, use the following: (cbor.isNumber() + && cbor.AsNumber().CanFitInSingle()).

      +
    • +
    • +

      boolean CanTruncatedIntFitInInt32()
      + Deprecated. +Instead, use the following: (cbor.CanValueFitInInt32() if only + integers of any tag are allowed, or (cbor.isNumber() + && cbor.AsNumber().CanTruncatedIntFitInInt32()).

      +
    • +
    • +

      boolean CanTruncatedIntFitInInt64()
      + Deprecated. +Instead, use the following: (cbor.CanValueFitInInt64() if only + integers of any tag are allowed, or (cbor.isNumber() + && cbor.AsNumber().CanTruncatedIntFitInInt64()).

    • boolean CanValueFitInInt32()
      @@ -311,6 +407,13 @@

      Methods

      static CBORObject[] DecodeSequenceFromBytes(byte[] data, CBOREncodeOptions options)
      Generates a sequence of CBOR objects from an array of CBOR-encoded bytes.

      +
    • +
    • +

      static CBORObject Divide(CBORObject first, + CBORObject second)
      + Deprecated. +Instead, convert both CBOR objects to numbers (with .AsNumber()), and + use the first number’s.Divide() method.

    • byte[] EncodeToBytes()
      @@ -331,80 +434,12 @@

      Methods

      boolean equals(Object obj)
      Determines whether this object and another object are equal and have the same type.

      -
    • -
    • -

      static CBORObject FromBool(boolean value)
      - Returns the CBOR true value or false value, depending on “value”.

      -
    • -
    • -

      static CBORObject FromByte(byte value)
      - Generates a CBOR object from a byte (0 to 255).

      -
    • -
    • -

      static CBORObject FromByteArray(byte[] bytes)
      - Generates a CBOR object from an array of 8-bit bytes; the byte array is - copied to a new byte array in this process.

      -
    • -
    • -

      static CBORObject FromCBORArray(CBORObject[] array)
      - Generates a CBOR object from an array of CBOR objects.

      -
    • -
    • -

      static CBORObject FromCBORObjectAndTag(CBORObject cborObj, - int smallTag)
      - Generates a CBOR object from an arbitrary object and gives the resulting - object a tag in addition to its existing tags (the new tag is made the - outermost tag).

      -
    • -
    • -

      static CBORObject FromCBORObjectAndTag(CBORObject cborObj, - com.upokecenter.numbers.EInteger bigintTag)
      - Generates a CBOR object from an arbitrary object and gives the resulting - object a tag in addition to its existing tags (the new tag is made the - outermost tag).

      -
    • -
    • -

      static CBORObject FromDouble(double value)
      - Generates a CBOR object from a 64-bit floating-point number.

      -
    • -
    • -

      static CBORObject FromEDecimal(com.upokecenter.numbers.EDecimal bigValue)
      - Generates a CBOR object from a decimal number.

      -
    • -
    • -

      static CBORObject FromEFloat(com.upokecenter.numbers.EFloat bigValue)
      - Generates a CBOR object from an arbitrary-precision binary floating-point - number.

      -
    • -
    • -

      static CBORObject FromEInteger(com.upokecenter.numbers.EInteger bigintValue)
      - Generates a CBOR object from an arbitrary-precision integer.

      -
    • -
    • -

      static CBORObject FromERational(com.upokecenter.numbers.ERational bigValue)
      - Generates a CBOR object from an arbitrary-precision rational number.

    • static CBORObject FromFloatingPointBits(long floatingBits, int byteCount)
      Generates a CBOR object from a floating-point number represented by its bits.

      -
    • -
    • -

      static CBORObject FromGuid(UUID value)
      - Generates a CBOR object from a java.util.UUID.

      -
    • -
    • -

      static CBORObject FromInt16(short value)
      - Generates a CBOR object from a 16-bit signed integer.

      -
    • -
    • -

      static CBORObject FromInt32(int value)
      - Generates a CBOR object from a 32-bit signed integer.

      -
    • -
    • -

      static CBORObject FromInt64(long value)
      - Generates a CBOR object from a 64-bit signed integer.

    • static CBORObject FromJSONBytes(byte[] bytes)
      @@ -466,43 +501,43 @@

      Methods

    • static CBORObject FromJSONString(String str, + CBOREncodeOptions options)
      + Deprecated. +Instead, use.getFromJSONString()(str, + new JSONOptions(\allowduplicatekeys = true)) + or .getFromJSONString()(str, new + JSONOptions(\allowduplicatekeys = false)), as appropriate.

      +
    • +
    • +

      static CBORObject FromJSONString(String str, JSONOptions jsonoptions)
      Generates a CBOR object from a text string in JavaScript object Notation (JSON) format, using the specified options to control the decoding process.

      -
    • -
    • -

      static CBORObject FromMap(Iterable<Map.Entry<CBORObject,CBORObject>> keysAndValues)
      - Creates a new CBOR map that stores its keys in an undefined order.

    • static CBORObject FromObject(boolean value)
      - Deprecated. -Use FromBool instead.

      + Returns the CBOR true value or false value, depending on “value”.

    • static CBORObject FromObject(byte value)
      - Deprecated. -Use FromByte instead.

      + Generates a CBOR object from a byte (0 to 255).

    • static CBORObject FromObject(byte[] bytes)
      - Deprecated. -Use FromByteArray instead.

      + Generates a CBOR object from an array of 8-bit bytes; the byte array is + copied to a new byte array in this process.

    • static CBORObject FromObject(double value)
      - Deprecated. -Use FromDouble instead.

      + Generates a CBOR object from a 64-bit floating-point number.

    • static CBORObject FromObject(float value)
      - Deprecated. -Use FromFloat instead.

      + Generates a CBOR object from a 32-bit floating-point number.

    • static CBORObject FromObject(int value)
      - Deprecated. -Use FromInt instead.

      + Generates a CBOR object from a 32-bit signed integer.

    • static CBORObject FromObject(int[] array)
      @@ -510,8 +545,7 @@

      Methods

    • static CBORObject FromObject(long value)
      - Deprecated. -Use FromInt64 instead.

      + Generates a CBOR object from a 64-bit signed integer.

    • static CBORObject FromObject(long[] array)
      @@ -519,39 +553,32 @@

      Methods

    • static CBORObject FromObject(short value)
      - Deprecated. -Use FromInt16 instead.

      + Generates a CBOR object from a 16-bit signed integer.

    • static CBORObject FromObject(CBORObject value)
      - Deprecated. -Don’t use a function and use Nullable Reference Types to guard against - nulls.

      + Generates a CBOR object from a CBOR object.

    • static CBORObject FromObject(CBORObject[] array)
      - Deprecated. -Use FromCBORArray instead.

      + Generates a CBOR object from an array of CBOR objects.

    • static CBORObject FromObject(com.upokecenter.numbers.EDecimal bigValue)
      - Deprecated. -Use FromEDecimal instead.

      + Generates a CBOR object from a decimal number.

    • static CBORObject FromObject(com.upokecenter.numbers.EFloat bigValue)
      - Deprecated. -Use FromEFloat instead.

      + Generates a CBOR object from an arbitrary-precision binary floating-point + number.

    • static CBORObject FromObject(com.upokecenter.numbers.EInteger bigintValue)
      - Deprecated. -Use FromEInteger instead.

      + Generates a CBOR object from an arbitrary-precision integer.

    • static CBORObject FromObject(com.upokecenter.numbers.ERational bigValue)
      - Deprecated. -Use FromERational instead.

      + Generates a CBOR object from an arbitrary-precision rational number.

    • static CBORObject FromObject(Object obj)
      @@ -576,36 +603,25 @@

      Methods

    • static CBORObject FromObject(String strValue)
      - Deprecated. -Use FromString instead.

      + Generates a CBOR object from a text string.

    • static CBORObject FromObjectAndTag(Object valueObValue, int smallTag)
      - Deprecated. -Use FromCBORObjectAndTag instead.

      + Generates a CBOR object from an arbitrary object and gives the resulting + object a tag in addition to its existing tags (the new tag is made the + outermost tag).

    • -

      static CBORObject FromObjectAndTag(Object valueObValue, +

      static CBORObject FromObjectAndTag(Object valueOb, com.upokecenter.numbers.EInteger bigintTag)
      - Deprecated. -Use FromCBORObjectAndTag instead.

      -
    • -
    • -

      static CBORObject FromOrderedMap(Iterable<Map.Entry<CBORObject,CBORObject>> keysAndValues)
      - Creates a new CBOR map that ensures that keys are stored in order.

      + Generates a CBOR object from an arbitrary object and gives the resulting + object a tag in addition to its existing tags (the new tag is made the + outermost tag).

    • static CBORObject FromSimpleValue(int simpleValue)
      Creates a CBOR object from a simple value number.

      -
    • -
    • -

      static CBORObject FromSingle(float value)
      - Generates a CBOR object from a 32-bit floating-point number.

      -
    • -
    • -

      static CBORObject FromString(String strValue)
      - Generates a CBOR object from a text string.

    • CBORObject get(int index)
      @@ -650,22 +666,10 @@

      Methods

      untagged.

    • -

      CBORObject GetOrDefault(int key, - CBORObject defaultValue)
      - Gets the value of a CBOR object by integer index in this array, or a default - value if that value is not found.

      -
    • -
    • -

      CBORObject GetOrDefault(CBORObject cborkey, +

      CBORObject GetOrDefault(Object key, CBORObject defaultValue)
      Gets the value of a CBOR object by integer index in this array or by CBOR object key in this map, or a default value if that value is not found.

      -
    • -
    • -

      CBORObject GetOrDefault(String key, - CBORObject defaultValue)
      - Gets the value of a CBOR object by string key in a map, or a default value - if that value is not found.

    • final int getSimpleValue()
      @@ -733,19 +737,49 @@

      Methods

    • CBORObject Insert(int index, - CBORObject cborObj)
      - Inserts a CBORObject at the specified position in this CBOR array.

      -
    • -
    • -

      CBORObject Insert(int index, Object valueOb)
      - Deprecated. -Use the CBORObject overload instead.

      + Inserts an object at the specified position in this CBOR array.

    • final boolean isFalse()
      Gets a value indicating whether this value is a CBOR false value, whether tagged or not.

      +
    • +
    • +

      final boolean isFinite()
      + Deprecated. +Instead, use the following: (cbor.isNumber() + && cbor.AsNumber().IsFinite()).

      +
    • +
    • +

      boolean IsInfinity()
      + Deprecated. +Instead, use the following: (cbor.isNumber() + && cbor.AsNumber().IsInfinity()).

      +
    • +
    • +

      final boolean isIntegral()
      + Deprecated. +Instead, use the following: (cbor.isNumber() + && cbor.AsNumber().IsInteger()).

      +
    • +
    • +

      boolean IsNaN()
      + Deprecated. +Instead, use the following: (cbor.isNumber() + && cbor.AsNumber().IsNaN()).

      +
    • +
    • +

      final boolean isNegative()
      + Deprecated. +Instead, use (cbor.IsNumber() + && cbor.AsNumber().IsNegative()).

      +
    • +
    • +

      boolean IsNegativeInfinity()
      + Deprecated. +Instead, use the following: (cbor.isNumber() + && cbor.AsNumber().IsNegativeInfinity()).

    • final boolean isNull()
      @@ -756,6 +790,12 @@

      Methods

      final boolean isNumber()
      Gets a value indicating whether this CBOR object stores a number (including infinity or a not-a-number or NaN value).

      +
    • +
    • +

      boolean IsPositiveInfinity()
      + Deprecated. +Instead, use the following: (cbor.isNumber() + && cbor.AsNumber().IsPositiveInfinity()).

    • final boolean isTagged()
      @@ -770,6 +810,25 @@

      Methods

      final boolean isUndefined()
      Gets a value indicating whether this value is a CBOR undefined value, whether tagged or not.

      +
    • +
    • +

      final boolean isZero()
      + Deprecated. +Instead, use the following: (cbor.isNumber() + && cbor.AsNumber().IsZero()).

      +
    • +
    • +

      static CBORObject Multiply(CBORObject first, + CBORObject second)
      + Deprecated. +Instead, convert both CBOR objects to numbers (with .AsNumber()), and + use the first number’s.Multiply() method.

      +
    • +
    • +

      CBORObject Negate()
      + Deprecated. +Instead, convert this object to a number (with .AsNumber()), and + use that number’s.Negate() method.

    • static CBORObject NewArray()
      @@ -801,6 +860,16 @@

      Methods

    • static CBORObject ReadJSON(InputStream stream, + CBOREncodeOptions options)
      + Deprecated. +Instead, use.getReadJSON()(stream, + new JSONOptions(\allowduplicatekeys = true)) + or .getReadJSON()(stream, + new JSONOptions(\allowduplicatekeys = false)), + as appropriate.

      +
    • +
    • +

      static CBORObject ReadJSON(InputStream stream, JSONOptions jsonoptions)
      Generates a CBOR object from a data stream in JavaScript object Notation (JSON) format, using the specified options to control the decoding process.

      @@ -824,6 +893,13 @@

      Methods

      static CBORObject[] ReadSequence(InputStream stream, CBOREncodeOptions options)
      Reads a sequence of objects in CBOR format from a data stream.

      +
    • +
    • +

      static CBORObject Remainder(CBORObject first, + CBORObject second)
      + Deprecated. +Instead, convert both CBOR objects to numbers (with .AsNumber()), and + use the first number’s.Remainder() method.

    • boolean Remove(CBORObject obj)
      @@ -857,27 +933,28 @@

      Methods

      Sets the value of a CBOR object in this map, using a string as the key.

    • -

      CBORObject Set(int key, - CBORObject mapValue)
      - Sets the value of a CBORObject of type Array at the given index to the given - value.

      -
    • -
    • -

      CBORObject Set(CBORObject mapKey, - CBORObject mapValue)
      +

      CBORObject Set(Object key, + Object valueOb)
      Maps an object to a key in this CBOR map, or adds the value if the key doesn’t exist.

    • -

      CBORObject Set(Object key, - Object valueOb)
      +

      final int signum()
      Deprecated. -Use the CBORObject overload instead.

      +Instead, convert this object to a number with.AsNumber(), and use the + Sign property in.NET or the signum method in Java.

    • final int size()
      Gets the number of keys in this map, or the number of items in this array, or 0 if this item is neither an array nor a map.

      +
    • +
    • +

      static CBORObject Subtract(CBORObject first, + CBORObject second)
      + Deprecated. +Instead, convert both CBOR objects to numbers (with .AsNumber()), and + use the first number’s.Subtract() method.

    • byte[] ToJSONBytes()
      @@ -989,13 +1066,13 @@

      Methods

      OutputStream stream)

      Writes a decimal floating-point number in CBOR format to a data stream, as though it were converted to a CBOR object via - CBORObject.FromEDecimal(EDecimal) and then written out.

      + CBORObject.FromObject(EDecimal) and then written out.

    • static void Write(com.upokecenter.numbers.EFloat bignum, OutputStream stream)
      Writes a binary floating-point number in CBOR format to a data stream, as - though it were converted to a CBOR object via CBORObject.FromEFloat(EFloat) + though it were converted to a CBOR object via CBORObject.FromObject(EFloat) and then written out.

    • @@ -1007,7 +1084,7 @@

      Methods

      static void Write(com.upokecenter.numbers.ERational rational, OutputStream stream)
      Writes a rational number in CBOR format to a data stream, as though it were - converted to a CBOR object via CBORObject.FromERational(ERational) and then + converted to a CBOR object via CBORObject.FromObject(ERational) and then written out.

    • @@ -1165,6 +1242,28 @@

      isFalse

      false
      .
    +

    isFinite

    +
    @Deprecated public final boolean isFinite() Gets a value indicating whether this CBOR object represents a finite number.
    +
    + +

    Returns:

    + +
      +
    • true if this CBOR object represents a finite number; + otherwise, false.
    • +
    + +

    isIntegral

    +
    @Deprecated public final boolean isIntegral() Gets a value indicating whether this object represents an integer number,  that is, a number without a fractional part. Infinity and not-a-number are  not considered integers.
    +
    + +

    Returns:

    + +
      +
    • true if this object represents an integer number, that is, a + number without a fractional part; otherwise, false.
    • +
    +

    isNull

    public final boolean isNull() Gets a value indicating whether this CBOR object is a CBOR null value,  whether tagged or not.
     
    @@ -1209,6 +1308,17 @@

    isUndefined

    false. +

    isZero

    +
    @Deprecated public final boolean isZero() Gets a value indicating whether this object's value equals 0.
    +
    + +

    Returns:

    + +
      +
    • true if this object’s value equals 0; otherwise, + false.
    • +
    +

    getKeys

    public final Collection<CBORObject> getKeys() Gets a collection of the keys of this CBOR object. In general, the order in  which those keys occur is undefined unless this is a map created using the  NewOrderedMap method.
     
    @@ -1216,9 +1326,9 @@

    getKeys

    Returns:

      -
    • A read-only collection of the keys of this CBOR object. To avoid - potential problems, the calling code should not modify the CBOR map while - iterating over the returned collection.
    • +
    • A collection of the keys of this CBOR object. To avoid potential + problems, the calling code should not modify the CBOR map or the returned + collection while iterating over the returned collection.

    Throws:

    @@ -1227,6 +1337,17 @@

    getKeys

  • IllegalStateException - This object is not a map.
  • +

    isNegative

    +
    @Deprecated public final boolean isNegative() Gets a value indicating whether this object is a negative number.
    +
    + +

    Returns:

    + +
      +
    • true if this object is a negative number; otherwise, + false.
    • +
    +

    getMostOuterTag

    public final com.upokecenter.numbers.EInteger getMostOuterTag() Gets the outermost tag for this CBOR data item, or -1 if the item is  untagged.
     
    @@ -1238,6 +1359,23 @@

    getMostOuterTag

    untagged. +

    signum

    +
    @Deprecated public final int signum() Gets this value's sign: -1 if negative; 1 if positive; 0 if zero. Throws an  exception if this is a not-a-number value.
    +
    + +

    Returns:

    + +
      +
    • This value’s sign: -1 if negative; 1 if positive; 0 if zero.
    • +
    + +

    Throws:

    + +
      +
    • IllegalStateException - This object does not represent a number, or + this object is a not-a-number (NaN) value.
    • +
    +

    getSimpleValue

    public final int getSimpleValue() Gets the simple value ID of this CBOR object, or -1 if the object is not a  simple value. In this method, objects with a CBOR type of Boolean or  SimpleValue are simple values, whether they are tagged or not.
     
    @@ -1294,9 +1432,9 @@

    getValues

    Returns:

      -
    • A read-only collection of the values of this CBOR map or array. To - avoid potential problems, the calling code should not modify the CBOR map or - array while iterating over the returned collection.
    • +
    • A collection of the values of this CBOR map or array. To avoid + potential problems, the calling code should not modify the CBOR map or array + or the returned collection while iterating over the returned collection.

    Throws:

    @@ -1371,36 +1509,7 @@

    set

    GetOrDefault

    -
    public CBORObject GetOrDefault(CBORObject cborkey, CBORObject defaultValue) Gets the value of a CBOR object by integer index in this array or by CBOR  object key in this map, or a default value if that value is not found.
    -
    - -

    Parameters:

    - -
      -
    • -

      cborkey - An arbitrary CBORObject. If this is a CBOR map, this - parameter is converted to a CBOR object serving as the key to the map or - index to the array, and can be null. If this is a CBOR array, the key must - be an integer 0 or greater and less than the size of the array, and may be - any object convertible to a CBOR integer.

      -
    • -
    • -

      defaultValue - A value to return if an item with the given key doesn’t - exist, or if the CBOR object is an array and the key is not an integer 0 or - greater and less than the size of the array.

      -
    • -
    - -

    Returns:

    - -
      -
    • The CBOR object referred to by index or key in this array or map. If - this is a CBOR map, returns null (not CBORObject.Null) if - an item with the given key doesn’t exist.
    • -
    - -

    GetOrDefault

    -
    public CBORObject GetOrDefault(int key, CBORObject defaultValue) Gets the value of a CBOR object by integer index in this array, or a default  value if that value is not found.
    +
    public CBORObject GetOrDefault(Object key, CBORObject defaultValue) Gets the value of a CBOR object by integer index in this array or by CBOR  object key in this map, or a default value if that value is not found.
     

    Parameters:

    @@ -1428,32 +1537,6 @@

    GetOrDefault

    an item with the given key doesn’t exist. -

    GetOrDefault

    -
    public CBORObject GetOrDefault(String key, CBORObject defaultValue) Gets the value of a CBOR object by string key in a map, or a default value  if that value is not found.
    -
    - -

    Parameters:

    - -
      -
    • -

      key - An arbitrary string. If this is a CBOR map, this parameter is - converted to a CBOR object serving as the key to the map or index to the - array, and can be null. If this is a CBOR array, defaultValue is returned.

      -
    • -
    • -

      defaultValue - A value to return if an item with the given key doesn’t - exist, or if the CBOR object is an array.

      -
    • -
    - -

    Returns:

    - -
      -
    • The CBOR object referred to by index or key in this array or map. If - this is a CBOR map, returns null (not CBORObject.Null) if - an item with the given key doesn’t exist.
    • -
    -

    get

    public CBORObject get(CBORObject key) Gets the value of a CBOR object by integer index in this array or by CBOR  object key in this map.
     
    @@ -1567,6 +1650,40 @@

    set

    +

    Addition

    +
    @Deprecated public static CBORObject Addition(CBORObject first, CBORObject second) Finds the sum of two CBOR numbers.
    +
    + +

    Parameters:

    + +
      +
    • +

      first - The parameter first is a CBOR object.

      +
    • +
    • +

      second - The parameter second is a CBOR object.

      +
    • +
    + +

    Returns:

    + +
      +
    • A CBOR object.
    • +
    + +

    Throws:

    + +
      +
    • +

      IllegalArgumentException - Either or both operands are not numbers (as + opposed to Not-a-Number, NaN).

      +
    • +
    • +

      NullPointerException - The parameter first or second + is null.

      +
    • +
    +

    DecodeFromBytes

    public static CBORObject DecodeFromBytes(byte[] data) Generates a CBOR object from an array of CBOR-encoded bytes.
     
    @@ -1838,6 +1955,34 @@

    DecodeFromBytes

    +

    Divide

    +
    @Deprecated public static CBORObject Divide(CBORObject first, CBORObject second) Divides a CBORObject object by the value of a CBORObject object.
    +
    + +

    Parameters:

    + +
      +
    • +

      first - The parameter first is a CBOR object.

      +
    • +
    • +

      second - The parameter second is a CBOR object.

      +
    • +
    + +

    Returns:

    + +
      +
    • The quotient of the two objects.
    • +
    + +

    Throws:

    + +
      +
    • NullPointerException - The parameter first or second + is null.
    • +
    +

    FromJSONString

    public static CBORObject FromJSONString(String str, int offset, int count)
     
    @@ -1975,6 +2120,50 @@

    FromJSONString

    FromJSONString

    +
    @Deprecated public static CBORObject FromJSONString(String str, CBOREncodeOptions options)
    +
    +

    Generates a CBOR object from a text string in JavaScript object Notation + (JSON) format, using the specified options to control the decoding process. +

    +

    Note that if a CBOR object is converted to JSON with + ToJSONString, then the JSON is converted back to CBOR with this method, the + new CBOR object will not necessarily be the same as the old CBOR object, + especially if the old CBOR object uses data types not supported in JSON, + such as integers in map keys.

    + +

    Parameters:

    + +
      +
    • +

      str - A text string in JSON format. The entire string must contain a + single JSON object and not multiple objects. The string may not begin with a + byte-order mark (U+FEFF).

      +
    • +
    • +

      options - Specifies options to control the decoding process. This + method uses only the AllowDuplicateKeys property of this object.

      +
    • +
    + +

    Returns:

    + +
      +
    • A CBOR object containing the JSON data decoded.
    • +
    + +

    Throws:

    + +
      +
    • +

      NullPointerException - The parameter str or options + is null.

      +
    • +
    • +

      CBORException - The string is not in JSON format.

      +
    • +
    + +

    FromJSONString

    public static CBORObject FromJSONString(String str, int offset, int count, JSONOptions jsonoptions)
     

    Generates a CBOR object from a text string in JavaScript object Notation @@ -2627,24 +2816,8 @@

    DecodeObjectFromBytes

    -

    FromInt64

    -
    public static CBORObject FromInt64(long value) Generates a CBOR object from a 64-bit signed integer.
    -
    - -

    Parameters:

    - -
      -
    • value - The parameter value is a 64-bit signed integer.
    • -
    - -

    Returns:

    - -
      -
    • A CBOR object.
    • -
    -

    FromObject

    -
    @Deprecated public static CBORObject FromObject(long value) Generates a CBOR object from a 64-bit signed integer.
    +
    public static CBORObject FromObject(long value) Generates a CBOR object from a 64-bit signed integer.
     

    Parameters:

    @@ -2660,7 +2833,7 @@

    FromObject

    FromObject

    -
    @Deprecated public static CBORObject FromObject(CBORObject value) Generates a CBOR object from a CBOR object.
    +
    public static CBORObject FromObject(CBORObject value) Generates a CBOR object from a CBOR object.
     

    Parameters:

    @@ -2695,8 +2868,8 @@

    CalcEncodedSize

    map that includes itself. -

    FromEInteger

    -
    public static CBORObject FromEInteger(com.upokecenter.numbers.EInteger bigintValue)
    +

    FromObject

    +
    public static CBORObject FromObject(com.upokecenter.numbers.EInteger bigintValue)
     

    Generates a CBOR object from an arbitrary-precision integer. The CBOR object is generated as follows:

    @@ -2720,25 +2893,8 @@

    FromEInteger

    if bigintValue is null. -

    FromObject

    -
    @Deprecated public static CBORObject FromObject(com.upokecenter.numbers.EInteger bigintValue) Generates a CBOR object from an arbitrary-precision integer.
    -
    - -

    Parameters:

    - -
      -
    • bigintValue - An arbitrary-precision integer. Can be null.
    • -
    - -

    Returns:

    - -
      -
    • The given number encoded as a CBOR object. Returns CBORObject.Null - if bigintValue is null.
    • -
    - -

    FromEFloat

    -
    public static CBORObject FromEFloat(com.upokecenter.numbers.EFloat bigValue)
    +

    FromObject

    +
    public static CBORObject FromObject(com.upokecenter.numbers.EFloat bigValue)
     

    Generates a CBOR object from an arbitrary-precision binary floating-point number. The CBOR object is generated as follows (this is a change in version @@ -2765,24 +2921,8 @@

    FromEFloat

    if bigValue is null. -

    FromObject

    -
    @Deprecated public static CBORObject FromObject(com.upokecenter.numbers.EFloat bigValue) Generates a CBOR object from an arbitrary-precision binary floating-point  number.
    -
    - -

    Parameters:

    - -
      -
    • bigValue - An arbitrary-precision binary floating-point number.
    • -
    - -

    Returns:

    - -
      -
    • The given number encoded as a CBOR object.
    • -
    - -

    FromERational

    -
    public static CBORObject FromERational(com.upokecenter.numbers.ERational bigValue)
    +

    FromObject

    +
    public static CBORObject FromObject(com.upokecenter.numbers.ERational bigValue)
     

    Generates a CBOR object from an arbitrary-precision rational number. The CBOR object is generated as follows (this is a change in version 4.0):

    @@ -2804,24 +2944,8 @@

    FromERational

    if bigValue is null. -

    FromObject

    -
    @Deprecated public static CBORObject FromObject(com.upokecenter.numbers.ERational bigValue) Generates a CBOR object from an arbitrary-precision rational number.
    -
    - -

    Parameters:

    - -
      -
    • bigValue - An arbitrary-precision rational number.
    • -
    - -

    Returns:

    - -
      -
    • The given number encoded as a CBOR object.
    • -
    - -

    FromEDecimal

    -
    public static CBORObject FromEDecimal(com.upokecenter.numbers.EDecimal bigValue)
    +

    FromObject

    +
    public static CBORObject FromObject(com.upokecenter.numbers.EDecimal bigValue)
     

    Generates a CBOR object from a decimal number. The CBOR object is generated as follows (this is a change in version 4.0):

    @@ -2846,24 +2970,8 @@

    FromEDecimal

    if bigValue is null. -

    FromObject

    -
    @Deprecated public static CBORObject FromObject(com.upokecenter.numbers.EDecimal bigValue) Generates a CBOR object from a decimal number.
    -
    - -

    Parameters:

    - -
      -
    • bigValue - An arbitrary-precision decimal number.
    • -
    - -

    Returns:

    - -
      -
    • The given number encoded as a CBOR object.
    • -
    - -

    FromString

    -
    public static CBORObject FromString(String strValue) Generates a CBOR object from a text string.
    +

    FromObject

    +
    public static CBORObject FromObject(String strValue) Generates a CBOR object from a text string.
     

    Parameters:

    @@ -2886,57 +2994,8 @@

    FromString

    point. -

    FromObject

    -
    @Deprecated public static CBORObject FromObject(String strValue) Generates a CBOR object from a text string.
    -
    - -

    Parameters:

    - -
      -
    • strValue - A text string value. Can be null.
    • -
    - -

    Returns:

    - -
      -
    • A CBOR object representing the string, or CBORObject.Null if - stringValue is null.
    • -
    - -

    FromInt32

    -
    public static CBORObject FromInt32(int value) Generates a CBOR object from a 32-bit signed integer.
    -
    - -

    Parameters:

    - -
      -
    • value - The parameter value is a 32-bit signed integer.
    • -
    - -

    Returns:

    - -
      -
    • A CBOR object.
    • -
    - -

    FromGuid

    -
    public static CBORObject FromGuid(UUID value) Generates a CBOR object from a java.util.UUID.
    -
    - -

    Parameters:

    - -
      -
    • value - The parameter value is a java.util.UUID.
    • -
    - -

    Returns:

    - -
      -
    • A CBOR object.
    • -
    -

    FromObject

    -
    @Deprecated public static CBORObject FromObject(int value) Generates a CBOR object from a 32-bit signed integer.
    +
    public static CBORObject FromObject(int value) Generates a CBOR object from a 32-bit signed integer.
     

    Parameters:

    @@ -2951,30 +3010,14 @@

    FromObject

  • A CBOR object.
  • -

    FromInt16

    -
    public static CBORObject FromInt16(short value) Generates a CBOR object from a 16-bit signed integer.
    -
    - -

    Parameters:

    - -
      -
    • value - The parameter value is a 16-bit signed integer.
    • -
    - -

    Returns:

    - -
      -
    • A CBOR object generated from the given integer.
    • -
    -

    FromObject

    -
    @Deprecated public static CBORObject FromObject(short value) Generates a CBOR object from a 16-bit signed integer.
    +
    public static CBORObject FromObject(short value) Generates a CBOR object from a 16-bit signed integer.
     

    Parameters:

      -
    • value - A 16-bit signed integer.
    • +
    • value - The parameter value is a 16-bit signed integer.

    Returns:

    @@ -2983,24 +3026,8 @@

    FromObject

  • A CBOR object generated from the given integer.
  • -

    FromBool

    -
    public static CBORObject FromBool(boolean value) Returns the CBOR true value or false value, depending on "value".
    -
    - -

    Parameters:

    - -
      -
    • value - Either true or false.
    • -
    - -

    Returns:

    - -
      -
    • CBORObject.True if value is true; otherwise CBORObject.False.
    • -
    -

    FromObject

    -
    @Deprecated public static CBORObject FromObject(boolean value) Returns the CBOR true value or false value, depending on "value".
    +
    public static CBORObject FromObject(boolean value) Returns the CBOR true value or false value, depending on "value".
     

    Parameters:

    @@ -3015,8 +3042,8 @@

    FromObject

  • CBORObject.True if value is true; otherwise CBORObject.False.
  • -

    FromByte

    -
    public static CBORObject FromByte(byte value) Generates a CBOR object from a byte (0 to 255).
    +

    FromObject

    +
    public static CBORObject FromObject(byte value) Generates a CBOR object from a byte (0 to 255).
     

    Parameters:

    @@ -3031,62 +3058,14 @@

    FromByte

  • A CBOR object generated from the given integer.
  • -

    FromObject

    -
    @Deprecated public static CBORObject FromObject(byte value) Generates a CBOR object from a byte.
    -
    - -

    Parameters:

    - -
      -
    • value - A byte.
    • -
    - -

    Returns:

    - -
      -
    • A CBOR object.
    • -
    - -

    FromSingle

    -
    public static CBORObject FromSingle(float value) Generates a CBOR object from a 32-bit floating-point number. The input value  can be a not-a-number (NaN) value (such as <code>Float.NaN</code> in DotNet or  Float.NaN in Java); however, NaN values have multiple forms that are  equivalent for many applications' purposes, and <code>Float.NaN</code> / <code>  Float.NaN</code> is only one of these equivalent forms. In fact, <code>  CBORObject.FromSingle(Float.NaN)</code> or <code>  CBORObject.FromSingle(Float.NaN)</code> could produce a CBOR-encoded object that  differs between DotNet and Java, because <code>Float.NaN</code> / <code>  Float.NaN</code> may have a different form in DotNet and Java (for example, the  NaN value's sign may be negative in DotNet, but positive in Java).
    -
    - -

    Parameters:

    - -
      -
    • value - The parameter value is a 32-bit floating-point number.
    • -
    - -

    Returns:

    - -
      -
    • A CBOR object generated from the given number.
    • -
    -

    FromObject

    -
    @Deprecated public static CBORObject FromObject(float value) Generates a CBOR object from a 32-bit floating-point number.
    +
    public static CBORObject FromObject(float value) Generates a CBOR object from a 32-bit floating-point number. The input value  can be a not-a-number (NaN) value (such as <code>Float.NaN</code> in DotNet or  Float.NaN in Java); however, NaN values have multiple forms that are  equivalent for many applications' purposes, and <code>Float.NaN</code> / <code>  Float.NaN</code> is only one of these equivalent forms. In fact, <code>  CBORObject.FromObject(Float.NaN)</code> or <code>  CBORObject.FromObject(Float.NaN)</code> could produce a CBOR-encoded object that  differs between DotNet and Java, because <code>Float.NaN</code> / <code>  Float.NaN</code> may have a different form in DotNet and Java (for example, the  NaN value's sign may be negative in DotNet, but positive in Java).
     

    Parameters:

      -
    • value - A 32-bit floating-point number.
    • -
    - -

    Returns:

    - -
      -
    • A CBOR object.
    • -
    - -

    FromDouble

    -
    public static CBORObject FromDouble(double value) Generates a CBOR object from a 64-bit floating-point number. The input value  can be a not-a-number (NaN) value (such as <code>Double.NaN</code>); however,  NaN values have multiple forms that are equivalent for many applications'  purposes, and <code>Double.NaN</code> is only one of these equivalent forms. In  fact, <code>CBORObject.FromDouble(Double.NaN)</code> could produce a CBOR-encoded  object that differs between DotNet and Java, because <code>Double.NaN</code> may  have a different form in DotNet and Java (for example, the NaN value's sign  may be negative in DotNet, but positive in Java).
    -
    - -

    Parameters:

    - -
      -
    • value - The parameter value is a 64-bit floating-point number.
    • +
    • value - The parameter value is a 32-bit floating-point number.

    Returns:

    @@ -3096,13 +3075,13 @@

    FromDouble

    FromObject

    -
    @Deprecated public static CBORObject FromObject(double value) Generates a CBOR object from a 64-bit floating-point number.
    +
    public static CBORObject FromObject(double value) Generates a CBOR object from a 64-bit floating-point number. The input value  can be a not-a-number (NaN) value (such as <code>Double.NaN</code>); however,  NaN values have multiple forms that are equivalent for many applications'  purposes, and <code>Double.NaN</code> is only one of these equivalent forms. In  fact, <code>CBORObject.FromObject(Double.NaN)</code> could produce a CBOR-encoded  object that differs between DotNet and Java, because <code>Double.NaN</code> may  have a different form in DotNet and Java (for example, the NaN value's sign  may be negative in DotNet, but positive in Java).
     

    Parameters:

      -
    • value - A 64-bit floating-point number.
    • +
    • value - The parameter value is a 64-bit floating-point number.

    Returns:

    @@ -3111,8 +3090,8 @@

    FromObject

  • A CBOR object generated from the given number.
  • -

    FromByteArray

    -
    public static CBORObject FromByteArray(byte[] bytes)
    +

    FromObject

    +
    public static CBORObject FromObject(byte[] bytes)
     

    Generates a CBOR object from an array of 8-bit bytes; the byte array is copied to a new byte array in this process. (This method can't be used to @@ -3132,25 +3111,8 @@

    FromByteArray

    to a new array, or CBORObject.Null if the value is null. -

    FromObject

    -
    @Deprecated public static CBORObject FromObject(byte[] bytes) Generates a CBOR object from an array of 8-bit bytes.
    -
    - -

    Parameters:

    - -
      -
    • bytes - An array of 8-bit bytes; can be null.
    • -
    - -

    Returns:

    - -
      -
    • A CBOR object where each element of the given byte array is copied - to a new array, or CBORObject.Null if the value is null.
    • -
    - -

    FromCBORArray

    -
    public static CBORObject FromCBORArray(CBORObject[] array) Generates a CBOR object from an array of CBOR objects.
    +

    FromObject

    +
    public static CBORObject FromObject(CBORObject[] array) Generates a CBOR object from an array of CBOR objects.
     

    Parameters:

    @@ -3166,22 +3128,6 @@

    FromCBORArray

    new array, or CBORObject.Null if the value is null. -

    FromObject

    -
    @Deprecated public static CBORObject FromObject(CBORObject[] array) Generates a CBOR object from an array of CBOR objects.
    -
    - -

    Parameters:

    - -
      -
    • array - An array of CBOR objects.
    • -
    - -

    Returns:

    - -
      -
    • A CBOR object.
    • -
    -

    FromObject

    public static CBORObject FromObject(int[] array) Generates a CBOR object from an array of 32-bit integers.
     
    @@ -3226,12 +3172,11 @@

    FromObject

  • obj - <p>The parameter obj is an arbitrary object, which can be null. </p><p>NOTE: For security reasons, whenever possible, an application should not base this parameter on user input or other externally - supplied data, and whenever possible, the application should limit this - parameter’s inputs to types specially handled by this method (such as - int or string) and/or to plain-old-data types (POCO or POJO types) - within the control of the application. If the plain-old-data type references - other data types, those types should likewise meet either criterion - above.</p>.
  • + supplied data unless the application limits this parameter’s inputs to types + specially handled by this method (such as int or string) + and/or to plain-old-data types (POCO or POJO types) within the control of + the application. If the plain-old-data type references other data types, + those types should likewise meet either criterion above.</p>.

    Returns:

    @@ -3252,11 +3197,11 @@

    FromObject

    </p><p>NOTE: For security reasons, whenever possible, an application should not base this parameter on user input or other externally supplied - data, and whenever possible, the application should limit this parameter’s - inputs to types specially handled by this method (such as int or - string) and/or to plain-old-data types (POCO or POJO types) within - the control of the application. If the plain-old-data type references other - data types, those types should likewise meet either criterion above.</p>.

    + data unless the application limits this parameter’s inputs to types + specially handled by this method (such as int or string) + and/or to plain-old-data types (POCO or POJO types) within the control of + the application. If the plain-old-data type references other data types, + those types should likewise meet either criterion above.</p>.

    • options - An object containing options to control how certain objects @@ -3287,11 +3232,11 @@

      FromObject

    </p><p>NOTE: For security reasons, whenever possible, an application should not base this parameter on user input or other externally supplied - data, and whenever possible, the application should limit this parameter’s - inputs to types specially handled by this method (such as int or - string) and/or to plain-old-data types (POCO or POJO types) within - the control of the application. If the plain-old-data type references other - data types, those types should likewise meet either criterion above.</p>.

    + data unless the application limits this parameter’s inputs to types + specially handled by this method (such as int or string) + and/or to plain-old-data types (POCO or POJO types) within the control of + the application. If the plain-old-data type references other data types, + those types should likewise meet either criterion above.</p>.

    • mapper - An object containing optional converters to convert objects of @@ -3433,11 +3378,11 @@

      FromObject

    </p><p>NOTE: For security reasons, whenever possible, an application should not base this parameter on user input or other externally supplied - data, and whenever possible, the application should limit this parameter’s - inputs to types specially handled by this method (such as int or - string) and/or to plain-old-data types (POCO or POJO types) within - the control of the application. If the plain-old-data type references other - data types, those types should likewise meet either criterion above.</p>.

    + data unless the application limits this parameter’s inputs to types + specially handled by this method (such as int or string) + and/or to plain-old-data types (POCO or POJO types) within the control of + the application. If the plain-old-data type references other data types, + those types should likewise meet either criterion above.</p>.

    • @@ -3503,118 +3448,59 @@

      WithTag

    -

    FromCBORObjectAndTag

    -
    public static CBORObject FromCBORObjectAndTag(CBORObject cborObj, com.upokecenter.numbers.EInteger bigintTag) Generates a CBOR object from an arbitrary object and gives the resulting  object a tag in addition to its existing tags (the new tag is made the  outermost tag).
    -
    - -

    Parameters:

    - -
      -
    • cborObj - <p>The parameter cborObj is a CBORObject.
    • -
    -

    </p><p>NOTE: For security reasons, whenever possible, an application - should not base this parameter on user input or other externally supplied - data, and whenever possible, the application should limit this parameter’s - inputs to types specially handled by this method (such as int or - string) and/or to plain-old-data types (POCO or POJO types) within - the control of the application. If the plain-old-data type references other - data types, those types should likewise meet either criterion above.</p>.

    - -
      -
    • bigintTag - <p>Tag number. The tag number 55799 can be used to mark a - “self-described CBOR” object. This document does not attempt to list all - CBOR tags and their meanings. An up-to-date list can be found at the CBOR - Tags registry maintained by the Internet Assigned Numbers Authority( - iana.org/assignments/cbor-tags).</p>
    • -
    - -

    Returns:

    - -
      -
    • A CBOR object where the object cborObj is given the tag - bigintTag.
    • -
    - -

    Throws:

    - -
      -
    • -

      IllegalArgumentException - The parameter bigintTag is less than 0 or - greater than 2^64-1.

      -
    • -
    • -

      NullPointerException - The parameter bigintTag is null.

      -
    • -
    -

    FromObjectAndTag

    -
    @Deprecated public static CBORObject FromObjectAndTag(Object valueObValue, com.upokecenter.numbers.EInteger bigintTag) Generates a CBOR object from an arbitrary object and gives the resulting  object a tag in addition to its existing tags (the new tag is made the  outermost tag).
    +
    public static CBORObject FromObjectAndTag(Object valueOb, com.upokecenter.numbers.EInteger bigintTag) Generates a CBOR object from an arbitrary object and gives the resulting  object a tag in addition to its existing tags (the new tag is made the  outermost tag).
     

    Parameters:

    • -

      valueObValue - An arbitrary object, which can be null.

      +

      valueOb - <p>The parameter valueOb is an arbitrary object, + which can be null. </p><p>NOTE: For security reasons, whenever + possible, an application should not base this parameter on user input or + other externally supplied data unless the application limits this + parameter’s inputs to types specially handled by this method (such as + int or string) and/or to plain-old-data types (POCO or POJO types) + within the control of the application. If the plain-old-data type references + other data types, those types should likewise meet either criterion + above.</p>.

    • -

      bigintTag - Tag number.

      -
    • -
    - -

    Returns:

    - -
      -
    • A CBOR object where the object valueObValue is given the tag - bigintTag.
    • -
    - -

    WithTag

    -
    public CBORObject WithTag(int smallTag) Generates a CBOR object from an arbitrary object and gives the resulting  object a tag in addition to its existing tags (the new tag is made the  outermost tag).
    -
    - -

    Parameters:

    - -
      -
    • smallTag - <p>A 32-bit integer that specifies a tag number. The tag - number 55799 can be used to mark a “self-described CBOR” object. This - document does not attempt to list all CBOR tags and their meanings. An - up-to-date list can be found at the CBOR Tags registry maintained by the - Internet Assigned Numbers Authority (iana.org/assignments/cbor-tags -).</p>
    • +

      bigintTag - <p>Tag number. The tag number 55799 can be used to mark a + “self-described CBOR” object. This document does not attempt to list all + CBOR tags and their meanings. An up-to-date list can be found at the CBOR + Tags registry maintained by the Internet Assigned Numbers Authority( + iana.org/assignments/cbor-tags).</p>

      +

    Returns:

      -
    • A CBOR object with the same value as this one but given the tag - smallTag in addition to its existing tags (the new tag is made the - outermost tag).
    • +
    • A CBOR object where the object valueOb is converted to a + CBOR object and given the tag bigintTag. If valueOb is null, + returns a version of CBORObject.Null with the given tag.

    Throws:

      -
    • IllegalArgumentException - The parameter smallTag is less than 0.
    • +
    • +

      IllegalArgumentException - The parameter bigintTag is less than 0 or + greater than 2^64-1.

      +
    • +
    • +

      NullPointerException - The parameter bigintTag is null.

      +
    -

    FromCBORObjectAndTag

    -
    public static CBORObject FromCBORObjectAndTag(CBORObject cborObj, int smallTag) Generates a CBOR object from an arbitrary object and gives the resulting  object a tag in addition to its existing tags (the new tag is made the  outermost tag).
    +

    WithTag

    +
    public CBORObject WithTag(int smallTag) Generates a CBOR object from an arbitrary object and gives the resulting  object a tag in addition to its existing tags (the new tag is made the  outermost tag).
     

    Parameters:

    -
      -
    • cborObj - <p>The parameter cborObj is a CBORObject.
    • -
    -

    </p><p>NOTE: For security reasons, whenever possible, an application - should not base this parameter on user input or other externally supplied - data, and whenever possible, the application should limit this parameter’s - inputs to types specially handled by this method (such as int or - string) and/or to plain-old-data types (POCO or POJO types) within - the control of the application. If the plain-old-data type references other - data types, those types should likewise meet either criterion above.</p>.

    -
    • smallTag - <p>A 32-bit integer that specifies a tag number. The tag number 55799 can be used to mark a “self-described CBOR” object. This @@ -3627,9 +3513,9 @@

      FromCBORObjectAndTag

      Returns:

        -
      • A CBOR object where the object cborObj is given the tag - smallTag. If “valueOb” is null, returns a version of CBORObject.Null - with the given tag.
      • +
      • A CBOR object with the same value as this one but given the tag + smallTag in addition to its existing tags (the new tag is made the + outermost tag).

      Throws:

      @@ -3639,25 +3525,39 @@

      FromCBORObjectAndTag

    FromObjectAndTag

    -
    @Deprecated public static CBORObject FromObjectAndTag(Object valueObValue, int smallTag) Generates a CBOR object from an arbitrary object and gives the resulting  object a tag in addition to its existing tags (the new tag is made the  outermost tag).
    +
    public static CBORObject FromObjectAndTag(Object valueObValue, int smallTag) Generates a CBOR object from an arbitrary object and gives the resulting  object a tag in addition to its existing tags (the new tag is made the  outermost tag).
     

    Parameters:

    • -

      valueObValue - The parameter, an arbitrary object, which can be null.

      +

      valueObValue - <p>The parameter valueObValue is an arbitrary + object, which can be null. </p><p>NOTE: For security reasons, + whenever possible, an application should not base this parameter on user + input or other externally supplied data unless the application limits this + parameter’s inputs to types specially handled by this method (such as + int or string) and/or to plain-old-data types (POCO or POJO types) + within the control of the application. If the plain-old-data type references + other data types, those types should likewise meet either criterion + above.</p>.

    • -

      smallTag - A 32-bit integer that specifies a tag number.

      +

      smallTag - <p>A 32-bit integer that specifies a tag number. The tag + number 55799 can be used to mark a “self-described CBOR” object. This + document does not attempt to list all CBOR tags and their meanings. An + up-to-date list can be found at the CBOR Tags registry maintained by the + Internet Assigned Numbers Authority (iana.org/assignments/cbor-tags +).</p>

    Returns:

      -
    • A CBOR object where the object valueObValue is given the tag - smallTag.
    • +
    • A CBOR object where the object valueObValue is converted to + a CBOR object and given the tag smallTag. If “valueOb” is null, + returns a version of CBORObject.Null with the given tag.

    Throws:

    @@ -3690,44 +3590,52 @@

    FromSimpleValue

    greater than 255, or from 24 through 31. -

    NewArray

    -
    public static CBORObject NewArray() Creates a new empty CBOR array.
    +

    Multiply

    +
    @Deprecated public static CBORObject Multiply(CBORObject first, CBORObject second) Multiplies two CBOR numbers.
     
    -

    Returns:

    +

    Parameters:

      -
    • A new CBOR array.
    • +
    • +

      first - The parameter first is a CBOR object.

      +
    • +
    • +

      second - The parameter second is a CBOR object.

      +
    -

    NewMap

    -
    public static CBORObject NewMap() Creates a new empty CBOR map that stores its keys in an undefined order.
    -
    -

    Returns:

      -
    • A new CBOR map.
    • +
    • The product of the two numbers.
    -

    FromMap

    -
    public static CBORObject FromMap(Iterable<Map.Entry<CBORObject,CBORObject>> keysAndValues) Creates a new CBOR map that stores its keys in an undefined order.
    -
    - -

    Parameters:

    +

    Throws:

      -
    • keysAndValues - A sequence of key-value pairs.
    • +
    • +

      IllegalArgumentException - Either or both operands are not numbers (as + opposed to Not-a-Number, NaN).

      +
    • +
    • +

      NullPointerException - The parameter first or second + is null.

      +
    +

    NewArray

    +
    public static CBORObject NewArray() Creates a new empty CBOR array.
    +
    +

    Returns:

      -
    • A new CBOR map.
    • +
    • A new CBOR array.
    -

    NewOrderedMap

    -
    public static CBORObject NewOrderedMap() Creates a new empty CBOR map that ensures that keys are stored in the order  in which they are first inserted.
    +

    NewMap

    +
    public static CBORObject NewMap() Creates a new empty CBOR map that stores its keys in an undefined order.
     

    Returns:

    @@ -3736,16 +3644,10 @@

    NewOrderedMap

  • A new CBOR map.
  • -

    FromOrderedMap

    -
    public static CBORObject FromOrderedMap(Iterable<Map.Entry<CBORObject,CBORObject>> keysAndValues) Creates a new CBOR map that ensures that keys are stored in order.
    +

    NewOrderedMap

    +
    public static CBORObject NewOrderedMap() Creates a new empty CBOR map that ensures that keys are stored in the order  in which they are first inserted.
     
    -

    Parameters:

    - -
      -
    • keysAndValues - A sequence of key-value pairs.
    • -
    -

    Returns:

      @@ -3963,6 +3865,44 @@

      ReadJSONSequence

    +

    ReadJSON

    +
    @Deprecated public static CBORObject ReadJSON(InputStream stream, CBOREncodeOptions options) throws IOException Generates a CBOR object from a data stream in JavaScript object Notation  (JSON) format, using the specified options to control the decoding process.  The JSON stream may begin with a byte-order mark (U+FEFF). Since version  2.0, the JSON stream can be in UTF-8, UTF-16, or UTF-32 encoding; the  encoding is detected by assuming that the first character read must be a  byte-order mark or a nonzero basic character (U+0001 to U+007F). (In  previous versions, only UTF-8 was allowed.).
    +
    + +

    Parameters:

    + +
      +
    • +

      stream - A readable data stream. The sequence of bytes read from the + data stream must contain a single JSON object and not multiple objects.

      +
    • +
    • +

      options - Contains options to control the JSON decoding process. This + method uses only the AllowDuplicateKeys property of this object.

      +
    • +
    + +

    Returns:

    + +
      +
    • A CBOR object containing the JSON data decoded.
    • +
    + +

    Throws:

    + +
      +
    • +

      NullPointerException - The parameter stream is null.

      +
    • +
    • +

      IOException - An I/O error occurred.

      +
    • +
    • +

      CBORException - The data stream contains invalid + encoding or is not in JSON format.

      +
    • +
    +

    ReadJSONSequence

    public static CBORObject[] ReadJSONSequence(InputStream stream, JSONOptions jsonoptions) throws IOException
     
    @@ -4012,7 +3952,7 @@

    ReadJSONSequence

    -

    ReadJSON

    +

    ReadJSON

    public static CBORObject ReadJSON(InputStream stream, JSONOptions jsonoptions) throws IOException Generates a CBOR object from a data stream in JavaScript object Notation  (JSON) format, using the specified options to control the decoding process.  The JSON stream may begin with a byte-order mark (U+FEFF). Since version  2.0, the JSON stream can be in UTF-8, UTF-16, or UTF-32 encoding; the  encoding is detected by assuming that the first character read must be a  byte-order mark or a nonzero basic character (U+0001 to U+007F). (In  previous versions, only UTF-8 was allowed.). (This behavior may change to  supporting only UTF-8, with or without a byte order mark, in version 5.0 or  later, perhaps with an option to restore the previous behavior of also  supporting UTF-16 and UTF-32.).
     
    @@ -4270,6 +4210,68 @@

    FromJSONBytes

    +

    Remainder

    +
    @Deprecated public static CBORObject Remainder(CBORObject first, CBORObject second) Finds the remainder that results when a CBORObject object is divided by the  value of a CBOR object.
    +
    + +

    Parameters:

    + +
      +
    • +

      first - The parameter first is a CBOR object.

      +
    • +
    • +

      second - The parameter second is a CBOR object.

      +
    • +
    + +

    Returns:

    + +
      +
    • The remainder of the two numbers.
    • +
    + +

    Throws:

    + +
      +
    • NullPointerException - The parameter first or second + is null.
    • +
    + +

    Subtract

    +
    @Deprecated public static CBORObject Subtract(CBORObject first, CBORObject second) Finds the difference between two CBOR number objects.
    +
    + +

    Parameters:

    + +
      +
    • +

      first - The parameter first is a CBOR object.

      +
    • +
    • +

      second - The parameter second is a CBOR object.

      +
    • +
    + +

    Returns:

    + +
      +
    • The difference of the two objects.
    • +
    + +

    Throws:

    + +
      +
    • +

      IllegalArgumentException - Either or both operands are not numbers (as + opposed to Not-a-Number, NaN).

      +
    • +
    • +

      NullPointerException - The parameter first or second + is null.

      +
    • +
    +

    Write

    public static void Write(String str, OutputStream stream) throws IOException Writes a text string in CBOR format to a data stream. The string will be  encoded using definite-length encoding regardless of its length.
     
    @@ -4326,7 +4328,7 @@

    Write

    Write

    -
    public static void Write(com.upokecenter.numbers.EFloat bignum, OutputStream stream) throws IOException Writes a binary floating-point number in CBOR format to a data stream, as  though it were converted to a CBOR object via CBORObject.FromEFloat(EFloat)  and then written out.
    +
    public static void Write(com.upokecenter.numbers.EFloat bignum, OutputStream stream) throws IOException Writes a binary floating-point number in CBOR format to a data stream, as  though it were converted to a CBOR object via CBORObject.FromObject(EFloat)  and then written out.
     

    Parameters:

    @@ -4353,7 +4355,7 @@

    Write

    Write

    -
    public static void Write(com.upokecenter.numbers.ERational rational, OutputStream stream) throws IOException Writes a rational number in CBOR format to a data stream, as though it were  converted to a CBOR object via CBORObject.FromERational(ERational) and then  written out.
    +
    public static void Write(com.upokecenter.numbers.ERational rational, OutputStream stream) throws IOException Writes a rational number in CBOR format to a data stream, as though it were  converted to a CBOR object via CBORObject.FromObject(ERational) and then  written out.
     

    Parameters:

    @@ -4379,7 +4381,7 @@

    Write

    Write

    -
    public static void Write(com.upokecenter.numbers.EDecimal bignum, OutputStream stream) throws IOException Writes a decimal floating-point number in CBOR format to a data stream, as  though it were converted to a CBOR object via  CBORObject.FromEDecimal(EDecimal) and then written out.
    +
    public static void Write(com.upokecenter.numbers.EDecimal bignum, OutputStream stream) throws IOException Writes a decimal floating-point number in CBOR format to a data stream, as  though it were converted to a CBOR object via  CBORObject.FromObject(EDecimal) and then written out.
     

    Parameters:

    @@ -4678,7 +4680,7 @@

    Write

    which will always be written as definite-length byte strings.
  • string objects. The strings will be encoded using definite-length encoding regardless of their length.
  • Any object accepted by the FromObject - method.
  • + static methods.

    Parameters:

    @@ -4687,11 +4689,11 @@

    Write

    </p><p>NOTE: For security reasons, whenever possible, an application should not base this parameter on user input or other externally supplied - data, and whenever possible, the application should limit this parameter’s - inputs to types specially handled by this method (such as int or - string) and/or to plain-old-data types (POCO or POJO types) within - the control of the application. If the plain-old-data type references other - data types, those types should likewise meet either criterion above.</p>.

    + data unless the application limits this parameter’s inputs to types + specially handled by this method (such as int or string) + and/or to plain-old-data types (POCO or POJO types) within the control of + the application. If the plain-old-data type references other data types, + those types should likewise meet either criterion above.</p>.

    • @@ -4737,11 +4739,11 @@

      WriteJSON

    </p><p>NOTE: For security reasons, whenever possible, an application should not base this parameter on user input or other externally supplied - data, and whenever possible, the application should limit this parameter’s - inputs to types specially handled by this method (such as int or - string) and/or to plain-old-data types (POCO or POJO types) within - the control of the application. If the plain-old-data type references other - data types, those types should likewise meet either criterion above.</p>.

    + data unless the application limits this parameter’s inputs to types + specially handled by this method (such as int or string) + and/or to plain-old-data types (POCO or POJO types) within the control of + the application. If the plain-old-data type references other data types, + those types should likewise meet either criterion above.</p>.

    • outputStream - A writable data stream.
    • @@ -4758,6 +4760,24 @@

      WriteJSON

    +

    Abs

    +
    @Deprecated public CBORObject Abs() Gets this object's absolute value.
    +
    + +

    Returns:

    + +
      +
    • This object’s absolute without its negative sign.
    • +
    + +

    Throws:

    + +
      +
    • IllegalStateException - This object does not represent a number (for + this purpose, infinities and not-a-number or NaN values, but not + CBORObject.Null, are considered numbers).
    • +
    +

    Add

    public CBORObject Add(Object key, Object valueOb)
     
    @@ -4765,8 +4785,8 @@

    Add

    key doesn't exist.

    NOTE: This method can't be used to add a tag to an existing CBOR object. To create a CBOR object with a given tag, call the - CBORObject.FromCBORObjectAndTag method and pass the CBOR object and - the desired tag number to that method.

    + CBORObject.FromObjectAndTag method and pass the CBOR object and the + desired tag number to that method.

    Parameters:

    @@ -4814,8 +4834,8 @@

    Add

    this method).

    NOTE: This method can't be used to add a tag to an existing CBOR object. To create a CBOR object with a given tag, call the - CBORObject.FromCBORObjectAndTag method and pass the CBOR object and - the desired tag number to that method.

    + CBORObject.FromObjectAndTag method and pass the CBOR object and the + desired tag number to that method.

    The following example creates a CBOR array and adds several CBOR objects, one of which has a custom CBOR tag, to that array. Note the chaining behavior made possible by this @@ -4823,98 +4843,224 @@

    Add

    CBORObject obj = CBORObject.NewArray()
      .Add(CBORObject.False) .Add(CBORObject.FromObject(5))
      .Add(CBORObject.FromObject("text string"))
    - .Add(CBORObject.FromCBORObjectAndTag(9999, 1));
    + .Add(CBORObject.FromObjectAndTag(9999, 1));
    +

    .

    + +

    Parameters:

    + +
      +
    • obj - The parameter obj is a CBOR object.
    • +
    + +

    Returns:

    + +
      +
    • This instance.
    • +
    + +

    Throws:

    + +
      +
    • IllegalStateException - This object is not an array.
    • +
    + +

    Add

    +
    public CBORObject Add(Object obj)
    +
    +

    Converts an object to a CBOR object and adds it to the end of this + array.

    +

    NOTE: This method can't be used to add a tag to an existing + CBOR object. To create a CBOR object with a given tag, call the + CBORObject.FromObjectAndTag method and pass the CBOR object and the desired + tag number to that method.

    +

    The following example creates a CBOR array + and adds several CBOR objects, one of which has a custom CBOR tag, to that + array. Note the chaining behavior made possible by this method.

    +
    CBORObject obj = CBORObject.NewArray() .Add(CBORObject.False) .Add(5)
    + .Add("text string") .Add(CBORObject.FromObjectAndTag(9999, 1));

    .

    -

    Parameters:

    +

    Parameters:

    + +
      +
    • obj - A CBOR object (or an object convertible to a CBOR object) to add + to this CBOR array.
    • +
    + +

    Returns:

    + +
      +
    • This instance.
    • +
    + +

    Throws:

    + +
      +
    • +

      IllegalStateException - This instance is not an array.

      +
    • +
    • +

      IllegalArgumentException - The type of obj is not supported.

      +
    • +
    + +

    AsEInteger

    +
    @Deprecated public com.upokecenter.numbers.EInteger AsEInteger() Converts this object to an arbitrary-precision integer. See the ToObject  overload taking a type for more information.
    +
    + +

    Returns:

    + +
      +
    • The closest arbitrary-precision integer to this object.
    • +
    + +

    Throws:

    + +
      +
    • +

      IllegalStateException - This object does not represent a number (for + the purposes of this method, infinity and not-a-number values, but not + CBORObject.Null, are considered numbers).

      +
    • +
    • +

      ArithmeticException - This object’s value is infinity or not-a-number + (NaN).

      +
    • +
    + +

    AsBoolean

    +
    public boolean AsBoolean() Returns false if this object is a CBOR false, null, or undefined value  (whether or not the object has tags); otherwise, true.
    +
    + +

    Returns:

    + +
      +
    • False if this object is a CBOR false, null, or undefined value; + otherwise, true.
    • +
    + +

    AsByte

    +
    @Deprecated public byte AsByte() Converts this object to a byte (0 to 255). Floating point values are  converted to integers by discarding their fractional parts.
    +
    + +

    Returns:

    + +
      +
    • The closest byte-sized integer to this object.
    • +
    + +

    Throws:

      -
    • obj - The parameter obj is a CBOR object.
    • +
    • +

      IllegalStateException - This object does not represent a number (for + this purpose, infinities and not-a-number or NaN values, but not + CBORObject.Null, are considered numbers).

      +
    • +
    • +

      ArithmeticException - This object’s value exceeds the range of a byte + (would be less than 0 or greater than 255 when converted to an integer by + discarding its fractional part).

      +
    +

    AsDouble

    +
    public double AsDouble() Converts this object to a 64-bit floating point number.
    +
    +

    Returns:

      -
    • This instance.
    • +
    • The closest 64-bit floating point number to this object. The return + value can be positive infinity or negative infinity if this value exceeds + the range of a 64-bit floating point number.

    Throws:

      -
    • IllegalStateException - This object is not an array.
    • +
    • IllegalStateException - This object does not represent a number (for + this purpose, infinities and not-a-number or NaN values, but not + CBORObject.Null, are considered numbers).
    -

    Add

    -
    public CBORObject Add(Object obj)
    +

    AsEDecimal

    +
    @Deprecated public com.upokecenter.numbers.EDecimal AsEDecimal() Converts this object to a decimal number.
     
    -

    Converts an object to a CBOR object and adds it to the end of this - array.

    -

    NOTE: This method can't be used to add a tag to an existing - CBOR object. To create a CBOR object with a given tag, call the - CBORObject.FromCBORObjectAndTag method and pass the CBOR object and the - desired tag number to that method.

    -

    The following example creates a - CBOR array and adds several CBOR objects, one of which has a custom CBOR - tag, to that array. Note the chaining behavior made possible by this - method.

    -
    CBORObject obj = CBORObject.NewArray()
    - .Add(CBORObject.False) .Add(5) .Add("text string")
    - .Add(CBORObject.FromCBORObjectAndTag(9999, 1));
    -

    .

    -

    Parameters:

    +

    Returns:

      -
    • obj - A CBOR object (or an object convertible to a CBOR object) to add - to this CBOR array.
    • +
    • A decimal number for this object’s value.
    • +
    + +

    Throws:

    + +
      +
    • IllegalStateException - This object does not represent a number (for + the purposes of this method, infinity and not-a-number values, but not + CBORObject.Null, are considered numbers).
    +

    AsEFloat

    +
    @Deprecated public com.upokecenter.numbers.EFloat AsEFloat() Converts this object to an arbitrary-precision binary floating point number.  See the ToObject overload taking a type for more information.
    +
    +

    Returns:

      -
    • This instance.
    • +
    • An arbitrary-precision binary floating-point number for this + object’s value.

    Throws:

      -
    • -

      IllegalStateException - This instance is not an array.

      -
    • -
    • -

      IllegalArgumentException - The type of obj is not supported.

      -
    • +
    • IllegalStateException - This object does not represent a number (for + the purposes of this method, infinity and not-a-number values, but not + CBORObject.Null, are considered numbers).
    -

    AsBoolean

    -
    public boolean AsBoolean() Returns false if this object is a CBOR false, null, or undefined value  (whether or not the object has tags); otherwise, true.
    +

    AsERational

    +
    @Deprecated public com.upokecenter.numbers.ERational AsERational() Converts this object to a rational number. See the ToObject overload taking  a type for more information.
     

    Returns:

      -
    • False if this object is a CBOR false, null, or undefined value; - otherwise, true.
    • +
    • A rational number for this object’s value.
    -

    AsDouble

    -
    public double AsDouble() Converts this object to a 64-bit floating point number.
    +

    Throws:

    + +
      +
    • IllegalStateException - This object does not represent a number (for + the purposes of this method, infinity and not-a-number values, but not + CBORObject.Null, are considered numbers).
    • +
    + +

    AsInt16

    +
    @Deprecated public short AsInt16() Converts this object to a 16-bit signed integer. Floating point values are  converted to integers by discarding their fractional parts.
     

    Returns:

      -
    • The closest 64-bit floating point number to this object. The return - value can be positive infinity or negative infinity if this value exceeds - the range of a 64-bit floating point number.
    • +
    • The closest 16-bit signed integer to this object.

    Throws:

      -
    • IllegalStateException - This object does not represent a number (for +
    • +

      IllegalStateException - This object does not represent a number (for this purpose, infinities and not-a-number or NaN values, but not - CBORObject.Null, are considered numbers).

    • + CBORObject.Null, are considered numbers).

      + +
    • +

      ArithmeticException - This object’s value exceeds the range of a 16-bit + signed integer.

      +

    AsInt32Value

    @@ -5125,45 +5271,62 @@

    AsInt32

    -

    AsSingle

    -
    public float AsSingle() Converts this object to a 32-bit floating point number.
    +

    AsInt64

    +
    @Deprecated public long AsInt64()
     
    +

    Converts this object to a 64-bit signed integer. Non-integer numbers are + converted to integers by discarding their fractional parts. (NOTE: To + determine whether this method call can succeed, call + AsNumber().getCanTruncatedIntFitInInt64() before calling this method. See + the example.).

    +

    The following example code (originally written in C# + for the.NET Framework) shows a way to check whether a given CBOR object + stores a 64-bit signed integer before getting its value.

    +
    CBORObject
    + obj = CBORObject.FromInt64(99999); if (obj.isIntegral() &&
    + obj.AsNumber().CanFitInInt64()) { /* Not an Int64; handle the error */
    + System.out.println("Not a 64-bit integer."); } else {
    + System.out.println("The value is " + obj.AsInt64()); }
    +

    .

    Returns:

      -
    • The closest 32-bit floating point number to this object. The return - value can be positive infinity or negative infinity if this object’s value - exceeds the range of a 32-bit floating point number.
    • +
    • The closest 64-bit signed integer to this object.

    Throws:

      -
    • IllegalStateException - This object does not represent a number (for +
    • +

      IllegalStateException - This object does not represent a number (for this purpose, infinities and not-a-number or NaN values, but not - CBORObject.Null, are considered numbers).

    • + CBORObject.Null, are considered numbers).

      + +
    • +

      ArithmeticException - This object’s value exceeds the range of a 64-bit + signed integer.

      +
    -

    AsGuid

    -
    public UUID AsGuid() Converts this object to a java.util.UUID.
    +

    AsSingle

    +
    public float AsSingle() Converts this object to a 32-bit floating point number.
     

    Returns:

      -
    • A java.util.UUID.
    • +
    • The closest 32-bit floating point number to this object. The return + value can be positive infinity or negative infinity if this object’s value + exceeds the range of a 32-bit floating point number.

    Throws:

      -
    • -

      IllegalStateException - This object does not represent a java.util.UUID.

      -
    • -
    • -

      CBORException - This object does not have the expected tag.

      -
    • +
    • IllegalStateException - This object does not represent a number (for + this purpose, infinities and not-a-number or NaN values, but not + CBORObject.Null, are considered numbers).

    AsString

    @@ -5171,10 +5334,10 @@

    AsString

    Gets the value of this object as a text string.

    This method is not - the "reverse" of the FromString method in the sense that FromString + the "reverse" of the FromObject method in the sense that FromObject can take either a text string or null, but this method can accept only text strings. The ToObject method is closer to a "reverse" - version to FromString than the AsString method: + version to FromObject than the AsString method: ToObject&lt;string&gt;(cbor) in DotNet, or ToObject(string.class) in Java, will convert a CBOR object to a DotNet or Java string if it represents a text string, or to null if IsNull returns @@ -5197,6 +5360,80 @@

    AsString

    cbor.AsString(). +

    CanFitInDouble

    +
    @Deprecated public boolean CanFitInDouble() Returns whether this object's value can be converted to a 64-bit floating  point number without its value being rounded to another numerical value.
    +
    + +

    Returns:

    + +
      +
    • true if this object’s value can be converted to a 64-bit + floating point number without its value being rounded to another numerical + value, or if this is a not-a-number value, even if the value’s diagnostic + information can’t fit in a 64-bit floating point number; otherwise, + false.
    • +
    + +

    CanFitInInt32

    +
    @Deprecated public boolean CanFitInInt32() Returns whether this object's numerical value is an integer, is -(2^31) or  greater, and is less than 2^31.
    +
    + +

    Returns:

    + +
      +
    • true if this object’s numerical value is an integer, is + -(2^31) or greater, and is less than 2^31; otherwise, false.
    • +
    + +

    CanFitInInt64

    +
    @Deprecated public boolean CanFitInInt64() Returns whether this object's numerical value is an integer, is -(2^63) or  greater, and is less than 2^63.
    +
    + +

    Returns:

    + +
      +
    • true if this object’s numerical value is an integer, is + -(2^63) or greater, and is less than 2^63; otherwise, false.
    • +
    + +

    CanFitInSingle

    +
    @Deprecated public boolean CanFitInSingle() Returns whether this object's value can be converted to a 32-bit floating  point number without its value being rounded to another numerical value.
    +
    + +

    Returns:

    + +
      +
    • true if this object’s value can be converted to a 32-bit + floating point number without its value being rounded to another numerical + value, or if this is a not-a-number value, even if the value’s diagnostic + information can’ t fit in a 32-bit floating point number; otherwise, + false.
    • +
    + +

    CanTruncatedIntFitInInt32

    +
    @Deprecated public boolean CanTruncatedIntFitInInt32() Returns whether this object's value, converted to an integer by discarding  its fractional part, would be -(2^31) or greater, and less than 2^31.
    +
    + +

    Returns:

    + +
      +
    • true if this object’s value, converted to an integer by + discarding its fractional part, would be -(2^31) or greater, and less than + 2^31; otherwise, false.
    • +
    + +

    CanTruncatedIntFitInInt64

    +
    @Deprecated public boolean CanTruncatedIntFitInInt64() Returns whether this object's value, converted to an integer by discarding  its fractional part, would be -(2^63) or greater, and less than 2^63.
    +
    + +

    Returns:

    + +
      +
    • true if this object’s value, converted to an integer by + discarding its fractional part, would be -(2^63) or greater, and less than + 2^63; otherwise, false.
    • +
    +

    compareTo

    public int compareTo(CBORObject other)
     
    @@ -5781,7 +6018,7 @@

    HasTag

    Insert

    -
    @Deprecated public CBORObject Insert(int index, Object valueOb) Inserts an object at the specified position in this CBOR array.
    +
    public CBORObject Insert(int index, Object valueOb) Inserts an object at the specified position in this CBOR array.
     

    Parameters:

    @@ -5815,37 +6052,68 @@

    Insert

    -

    Insert

    -
    public CBORObject Insert(int index, CBORObject cborObj) Inserts a CBORObject at the specified position in this CBOR array.
    +

    IsInfinity

    +
    @Deprecated public boolean IsInfinity() Gets a value indicating whether this CBOR object represents infinity.
     
    -

    Parameters:

    +

    Returns:

      -
    • -

      index - Index starting at 0 to insert at.

      -
    • -
    • -

      cborObj - A CBORObject representing the value.

      -
    • +
    • true if this CBOR object represents infinity; otherwise, + false.
    +

    IsNaN

    +
    @Deprecated public boolean IsNaN() Gets a value indicating whether this CBOR object represents a not-a-number  value (as opposed to whether this object does not express a number).
    +
    +

    Returns:

      -
    • This instance.
    • +
    • true if this CBOR object represents a not-a-number value (as + opposed to whether this object does not represent a number as defined by the + IsNumber property or isNumber() method in Java); otherwise, + false.
    • +
    + +

    IsNegativeInfinity

    +
    @Deprecated public boolean IsNegativeInfinity() Gets a value indicating whether this CBOR object represents negative  infinity.
    +
    + +

    Returns:

    + +
      +
    • true if this CBOR object represents negative infinity; + otherwise, false.
    • +
    + +

    IsPositiveInfinity

    +
    @Deprecated public boolean IsPositiveInfinity() Gets a value indicating whether this CBOR object represents positive  infinity.
    +
    + +

    Returns:

    + +
      +
    • true if this CBOR object represents positive infinity; + otherwise, false.
    • +
    + +

    Negate

    +
    @Deprecated public CBORObject Negate() Gets this object's value with the sign reversed.
    +
    + +

    Returns:

    + +
      +
    • The reversed-sign form of this number.

    Throws:

      -
    • -

      IllegalStateException - This object is not an array.

      -
    • -
    • -

      IllegalArgumentException - The parameter index is not a valid index - into this array.

      -
    • +
    • IllegalStateException - This object does not represent a number (for + this purpose, infinities and not-a-number or NaN values, but not + CBORObject.Null, are considered numbers).

    Clear

    @@ -5939,7 +6207,7 @@

    Remove

    Set

    -
    @Deprecated public CBORObject Set(Object key, Object valueOb) Maps an object to a key in this CBOR map, or adds the value if the key  doesn't exist. If this is a CBOR array, instead sets the value at the given  index to the given value.
    +
    public CBORObject Set(Object key, Object valueOb) Maps an object to a key in this CBOR map, or adds the value if the key  doesn't exist. If this is a CBOR array, instead sets the value at the given  index to the given value.
     

    Parameters:

    @@ -5980,71 +6248,6 @@

    Set

    -

    Set

    -
    public CBORObject Set(CBORObject mapKey, CBORObject mapValue) Maps an object to a key in this CBOR map, or adds the value if the key  doesn't exist.
    -
    - -

    Parameters:

    - -
      -
    • -

      mapKey - If this instance is a CBOR map, this parameter is an object - representing the key, which will be converted to a CBORObject; in this case, - this parameter can be null, in which case this value is converted to - CBORObject.Null.

      -
    • -
    • -

      mapValue - A CBORObject representing the value, which should be of type - CBORType.Map.

      -
    • -
    - -

    Returns:

    - -
      -
    • This instance.
    • -
    - -

    Throws:

    - -
      -
    • -

      IllegalStateException - This object is not a map.

      -
    • -
    • -

      IllegalArgumentException - The parameter mapValue or this instance is - a CBOR array.

      -
    • -
    - -

    Set

    -
    public CBORObject Set(int key, CBORObject mapValue) Sets the value of a CBORObject of type Array at the given index to the given  value.
    -
    - -

    Parameters:

    - -
      -
    • -

      key - This parameter must be a 32-bit signed integer(int) - identifying the index (starting from 0) of the item to set in the array.

      -
    • -
    • -

      mapValue - An CBORObject representing the value.

      -
    • -
    - -

    Returns:

    - -
      -
    • This instance.
    • -
    - -

    Throws:

    - -
      -
    • IllegalStateException - MapValue is not a an array.
    • -
    -

    ToJSONString

    public String ToJSONString()
     
    @@ -6110,17 +6313,17 @@

    ToJSONString

    A byte string will instead be converted to traditional base64 without whitespace and with padding if it has tag 22, or base16 for tag 23. (To create a CBOR object with a given tag, call the - CBORObject.FromCBORObjectAndTag method and pass the CBOR object and the - desired tag number to that method.)
  • Rational numbers will be - converted to their exact form, if possible, otherwise to a high-precision - approximation. (The resulting approximation could overflow to infinity, in - which case the rational number is converted to null.)
  • Simple values - other than true and false will be converted to null. (This doesn't include - floating-point numbers.)
  • Infinity and not-a-number will be converted - to null.
  • -

    Warning: In general, if this CBOR object - contains integer map keys or uses other features not supported in JSON, and - the application converts this CBOR object to JSON and back to CBOR, the + CBORObject.FromObjectAndTag method and pass the CBOR object and the desired + tag number to that method.)

  • Rational numbers will be converted to + their exact form, if possible, otherwise to a high-precision approximation. + (The resulting approximation could overflow to infinity, in which case the + rational number is converted to null.)
  • Simple values other than true + and false will be converted to null. (This doesn't include floating-point + numbers.)
  • Infinity and not-a-number will be converted to + null.
  • +

    Warning: In general, if this CBOR object contains + integer map keys or uses other features not supported in JSON, and the + application converts this CBOR object to JSON and back to CBOR, the application should not expect the new CBOR object to be exactly the same as the original. This is because the conversion in many cases may have to convert unsupported features in JSON to supported features which diff --git a/CBOR/api/com.upokecenter.cbor.JSONOptions.html b/CBOR/api/com.upokecenter.cbor.JSONOptions.html index 9263c6fb3..d4fb8c072 100644 --- a/CBOR/api/com.upokecenter.cbor.JSONOptions.html +++ b/CBOR/api/com.upokecenter.cbor.JSONOptions.html @@ -36,6 +36,11 @@

    Methods

  • final boolean getAllowDuplicateKeys()
    Gets a value indicating whether to allow duplicate keys when reading JSON.

    +
  • +
  • +

    final boolean getBase64Padding()
    + Deprecated. +This property now has no effect.

  • final boolean getKeepKeyOrder()
    @@ -94,6 +99,16 @@

    toString

    string constructor for this class.
  • +

    getBase64Padding

    +
    @Deprecated public final boolean getBase64Padding() Gets a value indicating whether the Base64Padding property is true. This  property has no effect; in previous versions, this property meant that  padding was written out when writing base64url or traditional base64 to  JSON.
    +
    + +

    Returns:

    + +
      +
    • A value indicating whether the Base64Padding property is true.
    • +
    +

    getPreserveNegativeZero

    public final boolean getPreserveNegativeZero() Gets a value indicating whether the JSON decoder should preserve the  distinction between positive zero and negative zero when the decoder decodes  JSON to a floating-point number format that makes this distinction. For a  value of <code>false</code>, if the result of parsing a JSON string would be a  floating-point negative zero, that result is a positive zero instead. (Note  that this property has no effect for conversion kind <code>  IntOrFloatFromDouble</code>, where floating-point zeros are not possible.).
     
    diff --git a/CBOR/api/com.upokecenter.cbor.PODOptions.html b/CBOR/api/com.upokecenter.cbor.PODOptions.html index 2b4d8cf3a..867a42f4d 100644 --- a/CBOR/api/com.upokecenter.cbor.PODOptions.html +++ b/CBOR/api/com.upokecenter.cbor.PODOptions.html @@ -82,18 +82,17 @@

    getUseCamelCase

    if the name starts with that word, then the name is converted to camel case, meaning the first letter in the name is converted to a basic lower-case letter if it's a basic upper-case letter ("A" to "Z"). (For example, "Name" - and "IsName" both become "name", and "IsIsName" becomes - "isName".)
  • In the Java version: For each eligible method name, the - word "get", "set", or "is" is removed from the name if the name starts with - that word, then the name is converted to camel case. (For example, - "getName", "setName", and "isName" all become "name".) For each eligible - field name, the word "is" is removed from the name if the name starts with - that word, then the name is converted to camel case. (For example, "name" - and "isName" both become "name".)
  • -

    In the description above, a - name "starts with" a word if that word begins the name and is followed by a - character other than a basic digit or basic lower-case letter, that is, - other than "a" to "z" or "0" to "9".

    + and "IsName" both become "name".)
  • In the Java version: For each + eligible method name, the word "get", "set", or "is" is removed from the + name if the name starts with that word, then the name is converted to camel + case. (For example, "getName", "setName", and "isName" all become "name".) + For each eligible field name, the word "is" is removed from the name if the + name starts with that word, then the name is converted to camel case. (For + example, "name" and "isName" both become "name".)
  • +

    In the + description above, a name "starts with" a word if that word begins the name + and is followed by a character other than a basic digit or basic lower-case + letter, that is, other than "a" to "z" or "0" to "9".

    Returns:

    diff --git a/CBOR/docs/PeterO.Cbor.CBORObject.html b/CBOR/docs/PeterO.Cbor.CBORObject.html index 229acc794..f6075aaf0 100644 --- a/CBOR/docs/PeterO.Cbor.CBORObject.html +++ b/CBOR/docs/PeterO.Cbor.CBORObject.html @@ -97,23 +97,7 @@

    Member Summary

  • [Equals(object)](#Equals_object) - Determines whether this object and another object are equal and have the same type.
  • [Equals(PeterO.Cbor.CBORObject)](#Equals_PeterO_Cbor_CBORObject) - Compares the equality of two CBOR objects.
  • [public static readonly PeterO.Cbor.CBORObject False;](#False) - Represents the value false.
  • -
  • [FromBool(bool)](#FromBool_bool) - Returns the CBOR true value or false value, depending on “value”.
  • -
  • [FromByte(byte)](#FromByte_byte) - Generates a CBOR object from a byte (0 to 255).
  • -
  • [FromByteArray(byte[])](#FromByteArray_byte) - Generates a CBOR object from an array of 8-bit bytes; the byte array is copied to a new byte array in this process.
  • -
  • [FromCBORArray(PeterO.Cbor.CBORObject[])](#FromCBORArray_PeterO_Cbor_CBORObject) - Generates a CBOR object from an array of CBOR objects.
  • -
  • [FromCBORObjectAndTag(PeterO.Cbor.CBORObject, int)](#FromCBORObjectAndTag_PeterO_Cbor_CBORObject_int) - Generates a CBOR object from an arbitrary object and gives the resulting object a tag in addition to its existing tags (the new tag is made the outermost tag).
  • -
  • [FromCBORObjectAndTag(PeterO.Cbor.CBORObject, PeterO.Numbers.EInteger)](#FromCBORObjectAndTag_PeterO_Cbor_CBORObject_PeterO_Numbers_EInteger) - Generates a CBOR object from an arbitrary object and gives the resulting object a tag in addition to its existing tags (the new tag is made the outermost tag).
  • -
  • [FromCBORObjectAndTag(PeterO.Cbor.CBORObject, ulong)](#FromCBORObjectAndTag_PeterO_Cbor_CBORObject_ulong) - Generates a CBOR object from an arbitrary object and gives the resulting object a tag.
  • -
  • [FromDecimal(decimal)](#FromDecimal_decimal) - Converts a.
  • -
  • [FromDouble(double)](#FromDouble_double) - Generates a CBOR object from a 64-bit floating-point number.
  • -
  • [FromEDecimal(PeterO.Numbers.EDecimal)](#FromEDecimal_PeterO_Numbers_EDecimal) - Generates a CBOR object from a decimal number.
  • -
  • [FromEFloat(PeterO.Numbers.EFloat)](#FromEFloat_PeterO_Numbers_EFloat) - Generates a CBOR object from an arbitrary-precision binary floating-point number.
  • -
  • [FromEInteger(PeterO.Numbers.EInteger)](#FromEInteger_PeterO_Numbers_EInteger) - Generates a CBOR object from an arbitrary-precision integer.
  • -
  • [FromERational(PeterO.Numbers.ERational)](#FromERational_PeterO_Numbers_ERational) - Generates a CBOR object from an arbitrary-precision rational number.
  • [FromFloatingPointBits(long, int)](#FromFloatingPointBits_long_int) - Generates a CBOR object from a floating-point number represented by its bits.
  • -
  • [FromInt16(short)](#FromInt16_short) - Generates a CBOR object from a 16-bit signed integer.
  • -
  • [FromInt32(int)](#FromInt32_int) - Generates a CBOR object from a 32-bit signed integer.
  • -
  • [FromInt64(long)](#FromInt64_long) - Generates a CBOR object from a 64-bit signed integer.
  • [FromJSONBytes(byte[])](#FromJSONBytes_byte) - Generates a CBOR object from a byte array in JavaScript Object Notation (JSON) format.
  • [FromJSONBytes(byte[], int, int)](#FromJSONBytes_byte_int_int) - Generates a CBOR object from a byte array in JavaScript Object Notation (JSON) format.
  • [FromJSONBytes(byte[], int, int, PeterO.Cbor.JSONOptions)](#FromJSONBytes_byte_int_int_PeterO_Cbor_JSONOptions) - Generates a CBOR object from a byte array in JavaScript Object Notation (JSON) format, using the specified options to control the decoding process.
  • @@ -124,43 +108,36 @@

    Member Summary

  • [FromJSONString(string, int, int)](#FromJSONString_string_int_int) - Generates a CBOR object from a text string in JavaScript Object Notation (JSON) format.
  • [FromJSONString(string, int, int, PeterO.Cbor.JSONOptions)](#FromJSONString_string_int_int_PeterO_Cbor_JSONOptions) - Generates a CBOR object from a text string in JavaScript Object Notation (JSON) format, using the specified options to control the decoding process.
  • [FromJSONString(string, PeterO.Cbor.JSONOptions)](#FromJSONString_string_PeterO_Cbor_JSONOptions) - Generates a CBOR object from a text string in JavaScript Object Notation (JSON) format, using the specified options to control the decoding process.
  • -
  • [FromObject(bool)](#FromObject_bool) - Deprecated: Use FromBool instead.
  • -
  • [FromObject(byte[])](#FromObject_byte) - Deprecated: Use FromByte instead. Deprecated: Use FromByteArray instead.
  • -
  • [FromObject(decimal)](#FromObject_decimal) - Deprecated: Use FromDecimal instead
  • -
  • [FromObject(double)](#FromObject_double) - Deprecated: Use FromDouble instead.
  • -
  • [FromObject(float)](#FromObject_float) - Deprecated: Use FromFloat instead.
  • -
  • [FromObject(int[])](#FromObject_int) - Deprecated: Use FromInt instead. Generates a CBOR object from an array of 32-bit integers.
  • -
  • [FromObject(long[])](#FromObject_long) - Deprecated: Use FromInt64 instead. Generates a CBOR object from an array of 64-bit integers.
  • +
  • [FromObject(bool)](#FromObject_bool) - Returns the CBOR true value or false value, depending on “value”.
  • +
  • [FromObject(byte[])](#FromObject_byte) - Generates a CBOR object from a byte. Generates a CBOR object from an array of 8-bit bytes.
  • +
  • [FromObject(decimal)](#FromObject_decimal) - Converts a.
  • +
  • [FromObject(double)](#FromObject_double) - Generates a CBOR object from a 64-bit floating-point number.
  • +
  • [FromObject(float)](#FromObject_float) - Generates a CBOR object from a 32-bit floating-point number.
  • +
  • [FromObject(int[])](#FromObject_int) - Generates a CBOR object from a 32-bit signed integer. Generates a CBOR object from an array of 32-bit integers.
  • +
  • [FromObject(long[])](#FromObject_long) - Generates a CBOR object from a 64-bit signed integer. Generates a CBOR object from an array of 64-bit integers.
  • [FromObject(object)](#FromObject_object) - Generates a CBORObject from an arbitrary object.
  • [FromObject(object, PeterO.Cbor.CBORTypeMapper)](#FromObject_object_PeterO_Cbor_CBORTypeMapper) - Generates a CBORObject from an arbitrary object.
  • [FromObject(object, PeterO.Cbor.CBORTypeMapper, PeterO.Cbor.PODOptions)](#FromObject_object_PeterO_Cbor_CBORTypeMapper_PeterO_Cbor_PODOptions) - Generates a CBORObject from an arbitrary object, using the given options to control how certain objects are converted to CBOR objects.
  • [FromObject(object, PeterO.Cbor.PODOptions)](#FromObject_object_PeterO_Cbor_PODOptions) - Generates a CBORObject from an arbitrary object.
  • -
  • [FromObject(PeterO.Cbor.CBORObject[])](#FromObject_PeterO_Cbor_CBORObject) - Deprecated: Don’t use a function and use Nullable Reference Types to guard against nulls. Deprecated: Use FromCBORArray instead.
  • -
  • [FromObject(PeterO.Numbers.EDecimal)](#FromObject_PeterO_Numbers_EDecimal) - Deprecated: Use FromEDecimal instead.
  • -
  • [FromObject(PeterO.Numbers.EFloat)](#FromObject_PeterO_Numbers_EFloat) - Deprecated: Use FromEFloat instead.
  • -
  • [FromObject(PeterO.Numbers.EInteger)](#FromObject_PeterO_Numbers_EInteger) - Deprecated: Use FromEInteger instead.
  • -
  • [FromObject(PeterO.Numbers.ERational)](#FromObject_PeterO_Numbers_ERational) - Deprecated: Use FromERational instead.
  • -
  • [FromObject(sbyte)](#FromObject_sbyte) - Deprecated: Use FromSbyte instead
  • -
  • [FromObject(short)](#FromObject_short) - Deprecated: Use FromInt16 instead.
  • -
  • [FromObject(string)](#FromObject_string) - Deprecated: Use FromString instead.
  • -
  • [FromObject(uint)](#FromObject_uint) - Deprecated: Use FromUInt instead
  • -
  • [FromObject(ulong)](#FromObject_ulong) - Deprecated: Use FromUInt64 instead
  • -
  • [FromObject(ushort)](#FromObject_ushort) - Deprecated: Use FromUShort instead
  • -
  • [FromObjectAndTag(object, int)](#FromObjectAndTag_object_int) - Deprecated: Use FromCBORObjectAndTag instead.
  • -
  • [FromObjectAndTag(object, PeterO.Numbers.EInteger)](#FromObjectAndTag_object_PeterO_Numbers_EInteger) - Deprecated: Use FromCBORObjectAndTag instead.
  • -
  • [FromSbyte(sbyte)](#FromSbyte_sbyte) - Converts a signed 8-bit integer to a CBOR object.
  • +
  • [FromObject(PeterO.Cbor.CBORObject[])](#FromObject_PeterO_Cbor_CBORObject) - Generates a CBOR object from a CBOR object. Generates a CBOR object from an array of CBOR objects.
  • +
  • [FromObject(PeterO.Numbers.EDecimal)](#FromObject_PeterO_Numbers_EDecimal) - Generates a CBOR object from a decimal number.
  • +
  • [FromObject(PeterO.Numbers.EFloat)](#FromObject_PeterO_Numbers_EFloat) - Generates a CBOR object from an arbitrary-precision binary floating-point number.
  • +
  • [FromObject(PeterO.Numbers.EInteger)](#FromObject_PeterO_Numbers_EInteger) - Generates a CBOR object from an arbitrary-precision integer.
  • +
  • [FromObject(PeterO.Numbers.ERational)](#FromObject_PeterO_Numbers_ERational) - Generates a CBOR object from an arbitrary-precision rational number.
  • +
  • [FromObject(sbyte)](#FromObject_sbyte) - Converts a signed 8-bit integer to a CBOR object.
  • +
  • [FromObject(short)](#FromObject_short) - Generates a CBOR object from a 16-bit signed integer.
  • +
  • [FromObject(string)](#FromObject_string) - Generates a CBOR object from a text string.
  • +
  • [FromObject(uint)](#FromObject_uint) - Converts a 32-bit unsigned integer to a CBOR object.
  • +
  • [FromObject(ulong)](#FromObject_ulong) - Converts a 64-bit unsigned integer to a CBOR object.
  • +
  • [FromObject(ushort)](#FromObject_ushort) - Converts a 16-bit unsigned integer to a CBOR object.
  • +
  • [FromObjectAndTag(object, int)](#FromObjectAndTag_object_int) - Generates a CBOR object from an arbitrary object and gives the resulting object a tag in addition to its existing tags (the new tag is made the outermost tag).
  • +
  • [FromObjectAndTag(object, PeterO.Numbers.EInteger)](#FromObjectAndTag_object_PeterO_Numbers_EInteger) - Generates a CBOR object from an arbitrary object and gives the resulting object a tag in addition to its existing tags (the new tag is made the outermost tag).
  • +
  • [FromObjectAndTag(object, ulong)](#FromObjectAndTag_object_ulong) -
  • [FromSimpleValue(int)](#FromSimpleValue_int) - Creates a CBOR object from a simple value number.
  • -
  • [FromSingle(float)](#FromSingle_float) - Generates a CBOR object from a 32-bit floating-point number.
  • -
  • [FromString(string)](#FromString_string) - Generates a CBOR object from a text string.
  • -
  • [FromUInt(uint)](#FromUInt_uint) - Converts a 32-bit unsigned integer to a CBOR object.
  • -
  • [FromUInt64(ulong)](#FromUInt64_ulong) - Converts a 64-bit unsigned integer to a CBOR object.
  • -
  • [FromUShort(ushort)](#FromUShort_ushort) - Converts a 16-bit unsigned integer to a CBOR object.
  • [GetAllTags()](#GetAllTags) - Gets a list of all tags, from outermost to innermost.
  • [GetByteString()](#GetByteString) - Gets the backing byte array used in this CBOR object, if this object is a byte string, without copying the data to a new byte array.
  • [GetHashCode()](#GetHashCode) - Calculates the hash code of this object.
  • -
  • [GetOrDefault(int, PeterO.Cbor.CBORObject)](#GetOrDefault_int_PeterO_Cbor_CBORObject) - Gets the value of a CBOR object by integer index in this array, or a default value if that value is not found.
  • -
  • [GetOrDefault(PeterO.Cbor.CBORObject, PeterO.Cbor.CBORObject)](#GetOrDefault_PeterO_Cbor_CBORObject_PeterO_Cbor_CBORObject) - Gets the value of a CBOR object by integer index in this array or by CBOR object key in this map, or a default value if that value is not found.
  • -
  • [GetOrDefault(string, PeterO.Cbor.CBORObject)](#GetOrDefault_string_PeterO_Cbor_CBORObject) - Gets the value of a CBOR object by string key in a map, or a default value if that value is not found.
  • +
  • [GetOrDefault(object, PeterO.Cbor.CBORObject)](#GetOrDefault_object_PeterO_Cbor_CBORObject) -
  • [HasMostInnerTag(int)](#HasMostInnerTag_int) - Returns whether this object has an innermost tag and that tag is of the given number.
  • [HasMostInnerTag(PeterO.Numbers.EInteger)](#HasMostInnerTag_PeterO_Numbers_EInteger) - Returns whether this object has an innermost tag and that tag is of the given number, expressed as an arbitrary-precision number.
  • [HasMostOuterTag(int)](#HasMostOuterTag_int) - Returns whether this object has an outermost tag and that tag is of the given number.
  • @@ -170,8 +147,7 @@

    Member Summary

  • [HasOneTag(PeterO.Numbers.EInteger)](#HasOneTag_PeterO_Numbers_EInteger) - Returns whether this object has only one tag and that tag is the given number, expressed as an arbitrary-precision integer.
  • [HasTag(int)](#HasTag_int) - Returns whether this object has a tag of the given number.
  • [HasTag(PeterO.Numbers.EInteger)](#HasTag_PeterO_Numbers_EInteger) - Returns whether this object has a tag of the given number.
  • -
  • [Insert(int, object)](#Insert_int_object) - Deprecated: Use the CBORObject overload instead.
  • -
  • [Insert(int, PeterO.Cbor.CBORObject)](#Insert_int_PeterO_Cbor_CBORObject) - Inserts a CBORObject at the specified position in this CBOR array.
  • +
  • [Insert(int, object)](#Insert_int_object) - Inserts an object at the specified position in this CBOR array.
  • [IsFalse](#IsFalse) - Gets a value indicating whether this value is a CBOR false value, whether tagged or not.
  • [IsNull](#IsNull) - Gets a value indicating whether this CBOR object is a CBOR null value, whether tagged or not.
  • [IsNumber](#IsNumber) - Gets a value indicating whether this CBOR object stores a number (including infinity or a not-a-number or NaN value).
  • @@ -203,9 +179,7 @@

    Member Summary

  • [Remove(object)](#Remove_object) - If this object is an array, removes the first instance of the specified item (once converted to a CBOR object) from the array.
  • [Remove(PeterO.Cbor.CBORObject)](#Remove_PeterO_Cbor_CBORObject) - If this object is an array, removes the first instance of the specified item from the array.
  • [RemoveAt(int)](#RemoveAt_int) - Removes the item at the given index of this CBOR array.
  • -
  • [Set(int, PeterO.Cbor.CBORObject)](#Set_int_PeterO_Cbor_CBORObject) - Sets the value of a CBORObject of type Array at the given index to the given value.
  • -
  • [Set(object, object)](#Set_object_object) - Deprecated: Use the CBORObject overload instead.
  • -
  • [Set(PeterO.Cbor.CBORObject, PeterO.Cbor.CBORObject)](#Set_PeterO_Cbor_CBORObject_PeterO_Cbor_CBORObject) - Maps an object to a key in this CBOR map, or adds the value if the key doesn’t exist.
  • +
  • [Set(object, object)](#Set_object_object) - Maps an object to a key in this CBOR map, or adds the value if the key doesn’t exist.
  • [SimpleValue](#SimpleValue) - Gets the simple value ID of this CBOR object, or -1 if the object is not a simple value.
  • [TagCount](#TagCount) - Gets the number of tags this object has.
  • [this[int]](#this_int) - Gets the value of a CBOR object by integer index in this array or by integer key in this map.
  • @@ -1856,460 +1830,38 @@

    Member Summary

    true if the objects are equal; otherwise, false . In this method, two objects are not equal if they don’t have the same type or if one is null and the other isn’t.

    -

    -### FromBool

    - -
    public static PeterO.Cbor.CBORObject FromBool(
    -    bool value);
    -
    - -

    Returns the CBOR true value or false value, depending on “value”.

    - -

    Parameters:

    - -
      -
    • value: Either true or false .
    • -
    - -

    Return Value:

    - -

    CBORObject.True if value is true; otherwise CBORObject.False.

    - -

    -### FromByte

    - -
    public static PeterO.Cbor.CBORObject FromByte(
    -    byte value);
    -
    - -

    Generates a CBOR object from a byte (0 to 255).

    - -

    Parameters:

    - -
      -
    • value: The parameter value - is a byte (from 0 to 255).
    • -
    - -

    Return Value:

    - -

    A CBOR object generated from the given integer.

    - -

    -### FromByteArray

    - -
    public static PeterO.Cbor.CBORObject FromByteArray(
    -    byte[] bytes);
    -
    - -

    Generates a CBOR object from an array of 8-bit bytes; the byte array is copied to a new byte array in this process. (This method can’t be used to decode CBOR data from a byte array; for that, use the DecodeFromBytes method instead.).

    - -

    Parameters:

    - -
      -
    • bytes: An array of 8-bit bytes; can be null.
    • -
    - -

    Return Value:

    - -

    A CBOR object where each element of the given byte array is copied to a new array, or CBORObject.Null if the value is null.

    - -

    -### FromCBORArray

    - -
    public static PeterO.Cbor.CBORObject FromCBORArray(
    -    PeterO.Cbor.CBORObject[] array);
    -
    - -

    Generates a CBOR object from an array of CBOR objects.

    - -

    Parameters:

    - -
      -
    • array: An array of CBOR objects.
    • -
    - -

    Return Value:

    - -

    A CBOR object where each element of the given array is copied to a new array, or CBORObject.Null if the value is null.

    - -

    -### FromCBORObjectAndTag

    - -
    public static PeterO.Cbor.CBORObject FromCBORObjectAndTag(
    -    PeterO.Cbor.CBORObject cborObj,
    -    int smallTag);
    -
    - -

    Generates a CBOR object from an arbitrary object and gives the resulting object a tag in addition to its existing tags (the new tag is made the outermost tag).

    - -

    Parameters:

    - -
      -
    • cborObj: The parameter cborObj - is a CBORObject. NOTE: For security reasons, whenever possible, an application should not base this parameter on user input or other externally supplied data, and whenever possible, the application should limit this parameter’s inputs to types specially handled by this method (such as int or String ) and/or to plain-old-data types (POCO or POJO types) within the control of the application. If the plain-old-data type references other data types, those types should likewise meet either criterion above.
    • -
    - -

    .

    - -
      -
    • smallTag: A 32-bit integer that specifies a tag number. The tag number 55799 can be used to mark a “self-described CBOR” object. This document does not attempt to list all CBOR tags and their meanings. An up-to-date list can be found at the CBOR Tags registry maintained by the Internet Assigned Numbers Authority ( iana.org/assignments/cbor-tags ).
    • -
    - -

    Return Value:

    - -

    A CBOR object where the object cborObj - is given the tag smallTag -. If “valueOb” is null, returns a version of CBORObject.Null with the given tag.

    - -

    Exceptions:

    - -
      -
    • System.ArgumentException: -The parameter smallTag - is less than 0.
    • -
    - -

    -### FromCBORObjectAndTag

    - -
    public static PeterO.Cbor.CBORObject FromCBORObjectAndTag(
    -    PeterO.Cbor.CBORObject cborObj,
    -    PeterO.Numbers.EInteger bigintTag);
    -
    - -

    Generates a CBOR object from an arbitrary object and gives the resulting object a tag in addition to its existing tags (the new tag is made the outermost tag).

    - -

    Parameters:

    - -
      -
    • cborObj: The parameter cborObj - is a CBORObject. NOTE: For security reasons, whenever possible, an application should not base this parameter on user input or other externally supplied data, and whenever possible, the application should limit this parameter’s inputs to types specially handled by this method (such as int or String ) and/or to plain-old-data types (POCO or POJO types) within the control of the application. If the plain-old-data type references other data types, those types should likewise meet either criterion above.
    • -
    - -

    .

    - -
      -
    • bigintTag: Tag number. The tag number 55799 can be used to mark a “self-described CBOR” object. This document does not attempt to list all CBOR tags and their meanings. An up-to-date list can be found at the CBOR Tags registry maintained by the Internet Assigned Numbers Authority( iana.org/assignments/cbor-tags ).
    • -
    - -

    Return Value:

    - -

    A CBOR object where the object cborObj - is given the tag bigintTag -.

    - -

    Exceptions:

    - -
      -
    • -

      System.ArgumentException: -The parameter bigintTag - is less than 0 or greater than 2^64-1.

      -
    • -
    • -

      System.ArgumentNullException: -The parameter bigintTag - is null.

      -
    • -
    - -

    -### FromCBORObjectAndTag

    - -
    public static PeterO.Cbor.CBORObject FromCBORObjectAndTag(
    -    PeterO.Cbor.CBORObject o,
    -    ulong tag);
    -
    - -

    This API is not CLS-compliant.

    - -

    Generates a CBOR object from an arbitrary object and gives the resulting object a tag.

    - -

    Parameters:

    - -
      -
    • -

      o: The parameter o - is an arbitrary CBORObject.

      -
    • -
    • -

      tag: A 64-bit integer that specifies a tag number. The tag number 55799 can be used to mark a “self-described CBOR” object. This document does not attempt to list all CBOR tags and their meanings. An up-to-date list can be found at the CBOR Tags registry maintained by the Internet Assigned Numbers Authority( iana.org/assignments/cbor-tags ).

      -
    • -
    - -

    Return Value:

    - -

    A CBOR object where the object o - is given the tag tag -. If “valueOb” is null, returns a version of CBORObject.Null with the given tag.

    - -

    -### FromDecimal

    - -
    public static PeterO.Cbor.CBORObject FromDecimal(
    -    decimal value);
    -
    - -

    Converts a.NET decimal to a CBOR object.

    - -

    Parameters:

    - -
      -
    • value: The parameter value - is a Decimal object.
    • -
    - -

    Return Value:

    - -

    A CBORObject object with the same value as the.NET decimal.

    - -

    -### FromDouble

    - -
    public static PeterO.Cbor.CBORObject FromDouble(
    -    double value);
    -
    - -

    Generates a CBOR object from a 64-bit floating-point number. The input value can be a not-a-number (NaN) value (such as Double.NaN ); however, NaN values have multiple forms that are equivalent for many applications’ purposes, and Double.NaN is only one of these equivalent forms. In fact, CBORObject.FromDouble(Double.NaN) could produce a CBOR-encoded object that differs between DotNet and Java, because Double.NaN may have a different form in DotNet and Java (for example, the NaN value’s sign may be negative in DotNet, but positive in Java).

    - -

    Parameters:

    - -
      -
    • value: The parameter value - is a 64-bit floating-point number.
    • -
    - -

    Return Value:

    - -

    A CBOR object generated from the given number.

    - -

    -### FromEDecimal

    - -
    public static PeterO.Cbor.CBORObject FromEDecimal(
    -    PeterO.Numbers.EDecimal bigValue);
    -
    - -

    Generates a CBOR object from a decimal number. The CBOR object is generated as follows (this is a change in version 4.0):

    - -
      -
    • -

      If the number is null, returns CBORObject.Null.

      -
    • -
    • -

      Otherwise, if the number expresses infinity, not-a-number, or negative zero, the CBOR object will have tag 268 and the appropriate format.

      -
    • -
    • -

      If the number’s exponent is at least 2^64 or less than -(2^64), the CBOR object will have tag 264 and the appropriate format.

      -
    • -
    • -

      Otherwise, the CBOR object will have tag 4 and the appropriate format.

      -
    • -
    - -

    Parameters:

    - -
      -
    • bigValue: An arbitrary-precision decimal number. Can be null.
    • -
    - -

    Return Value:

    - -

    The given number encoded as a CBOR object. Returns CBORObject.Null if bigValue - is null.

    - -

    -### FromEFloat

    - -
    public static PeterO.Cbor.CBORObject FromEFloat(
    -    PeterO.Numbers.EFloat bigValue);
    -
    - -

    Generates a CBOR object from an arbitrary-precision binary floating-point number. The CBOR object is generated as follows (this is a change in version 4.0):

    - -
      -
    • -

      If the number is null, returns CBORObject.Null.

      -
    • -
    • -

      Otherwise, if the number expresses infinity, not-a-number, or negative zero, the CBOR object will have tag 269 and the appropriate format.

      -
    • -
    • -

      Otherwise, if the number’s exponent is at least 2^64 or less than -(2^64), the CBOR object will have tag 265 and the appropriate format.

      -
    • -
    • -

      Otherwise, the CBOR object will have tag 5 and the appropriate format.

      -
    • -
    - -

    Parameters:

    - -
      -
    • bigValue: An arbitrary-precision binary floating-point number. Can be null.
    • -
    - -

    Return Value:

    - -

    The given number encoded as a CBOR object. Returns CBORObject.Null if bigValue - is null.

    - -

    -### FromEInteger

    - -
    public static PeterO.Cbor.CBORObject FromEInteger(
    -    PeterO.Numbers.EInteger bigintValue);
    -
    - -

    Generates a CBOR object from an arbitrary-precision integer. The CBOR object is generated as follows:

    - -
      -
    • -

      If the number is null, returns CBORObject.Null.

      -
    • -
    • -

      Otherwise, if the number is greater than or equal to -(2^64) and less than 2^64, the CBOR object will have the object type Integer and the appropriate value.

      -
    • -
    • -

      Otherwise, the CBOR object will have tag 2 (zero or positive) or 3 (negative) and the appropriate value.

      -
    • -
    - -

    Parameters:

    - -
      -
    • bigintValue: An arbitrary-precision integer. Can be null.
    • -
    - -

    Return Value:

    - -

    The given number encoded as a CBOR object. Returns CBORObject.Null if bigintValue - is null.

    - -

    -### FromERational

    - -
    public static PeterO.Cbor.CBORObject FromERational(
    -    PeterO.Numbers.ERational bigValue);
    -
    - -

    Generates a CBOR object from an arbitrary-precision rational number. The CBOR object is generated as follows (this is a change in version 4.0):

    - -
      -
    • -

      If the number is null, returns CBORObject.Null.

      -
    • -
    • -

      Otherwise, if the number expresses infinity, not-a-number, or negative zero, the CBOR object will have tag 270 and the appropriate format.

      -
    • -
    • -

      Otherwise, the CBOR object will have tag 30 and the appropriate format.

      -
    • -
    - -

    Parameters:

    - -
      -
    • bigValue: An arbitrary-precision rational number. Can be null.
    • -
    - -

    Return Value:

    - -

    The given number encoded as a CBOR object. Returns CBORObject.Null if bigValue - is null.

    -

    ### FromFloatingPointBits

    -
    public static PeterO.Cbor.CBORObject FromFloatingPointBits(
    -    long floatingBits,
    -    int byteCount);
    -
    - -

    Generates a CBOR object from a floating-point number represented by its bits.

    - -

    Parameters:

    - -
      -
    • -

      floatingBits: The bits of a floating-point number number to write.

      -
    • -
    • -

      byteCount: The number of bytes of the stored floating-point number; this also specifies the format of the “floatingBits” parameter. This value can be 2 if “floatingBits”’s lowest (least significant) 16 bits identify the floating-point number in IEEE 754r binary16 format; or 4 if “floatingBits”’s lowest (least significant) 32 bits identify the floating-point number in IEEE 754r binary32 format; or 8 if “floatingBits” identifies the floating point number in IEEE 754r binary64 format. Any other values for this parameter are invalid.

      -
    • -
    - -

    Return Value:

    - -

    A CBOR object storing the given floating-point number.

    - -

    Exceptions:

    - -
      -
    • System.ArgumentException: -The parameter byteCount - is other than 2, 4, or 8.
    • -
    - -

    -### FromInt16

    - -
    public static PeterO.Cbor.CBORObject FromInt16(
    -    short value);
    -
    - -

    Generates a CBOR object from a 16-bit signed integer.

    - -

    Parameters:

    - -
      -
    • value: The parameter value - is a 16-bit signed integer.
    • -
    - -

    Return Value:

    - -

    A CBOR object generated from the given integer.

    - -

    -### FromInt32

    - -
    public static PeterO.Cbor.CBORObject FromInt32(
    -    int value);
    -
    - -

    Generates a CBOR object from a 32-bit signed integer.

    - -

    Parameters:

    - -
      -
    • value: The parameter value - is a 32-bit signed integer.
    • -
    - -

    Return Value:

    - -

    A CBOR object.

    - -

    -### FromInt64

    - -
    public static PeterO.Cbor.CBORObject FromInt64(
    -    long value);
    +
    public static PeterO.Cbor.CBORObject FromFloatingPointBits(
    +    long floatingBits,
    +    int byteCount);
     
    -

    Generates a CBOR object from a 64-bit signed integer.

    +

    Generates a CBOR object from a floating-point number represented by its bits.

    Parameters:

      -
    • value: The parameter value - is a 64-bit signed integer.
    • +
    • +

      floatingBits: The bits of a floating-point number number to write.

      +
    • +
    • +

      byteCount: The number of bytes of the stored floating-point number; this also specifies the format of the “floatingBits” parameter. This value can be 2 if “floatingBits”’s lowest (least significant) 16 bits identify the floating-point number in IEEE 754r binary16 format; or 4 if “floatingBits”’s lowest (least significant) 32 bits identify the floating-point number in IEEE 754r binary32 format; or 8 if “floatingBits” identifies the floating point number in IEEE 754r binary64 format. Any other values for this parameter are invalid.

      +

    Return Value:

    -

    A CBOR object.

    +

    A CBOR object storing the given floating-point number.

    + +

    Exceptions:

    + +
      +
    • System.ArgumentException: +The parameter byteCount + is other than 2, 4, or 8.
    • +

    ### FromJSONBytes

    @@ -2792,8 +2344,6 @@

    Member Summary

    bool value);
    -

    Deprecated. Use FromBool instead.

    -

    Returns the CBOR true value or false value, depending on “value”.

    Parameters:

    @@ -2813,8 +2363,6 @@

    Member Summary

    byte value);
    -

    Deprecated. Use FromByte instead.

    -

    Generates a CBOR object from a byte.

    Parameters:

    @@ -2834,8 +2382,6 @@

    Member Summary

    byte[] bytes);
    -

    Deprecated. Use FromByteArray instead.

    -

    Generates a CBOR object from an array of 8-bit bytes.

    Parameters:

    @@ -2855,8 +2401,6 @@

    Member Summary

    decimal value);
    -

    Deprecated. Use FromDecimal instead

    -

    Converts a.NET decimal to a CBOR object.

    Parameters:

    @@ -2876,8 +2420,6 @@

    Member Summary

    double value);
    -

    Deprecated. Use FromDouble instead.

    -

    Generates a CBOR object from a 64-bit floating-point number.

    Parameters:

    @@ -2897,8 +2439,6 @@

    Member Summary

    float value);
    -

    Deprecated. Use FromFloat instead.

    -

    Generates a CBOR object from a 32-bit floating-point number.

    Parameters:

    @@ -2918,8 +2458,6 @@

    Member Summary

    int value);
    -

    Deprecated. Use FromInt instead.

    -

    Generates a CBOR object from a 32-bit signed integer.

    Parameters:

    @@ -2959,8 +2497,6 @@

    Member Summary

    long value);
    -

    Deprecated. Use FromInt64 instead.

    -

    Generates a CBOR object from a 64-bit signed integer.

    Parameters:

    @@ -3234,8 +2770,6 @@

    Member Summary

    PeterO.Cbor.CBORObject value);
    -

    Deprecated. Don’t use a function and use Nullable Reference Types to guard against nulls.

    -

    Generates a CBOR object from a CBOR object.

    Parameters:

    @@ -3258,8 +2792,6 @@

    Member Summary

    PeterO.Cbor.CBORObject[] array);
    -

    Deprecated. Use FromCBORArray instead.

    -

    Generates a CBOR object from an array of CBOR objects.

    Parameters:

    @@ -3279,8 +2811,6 @@

    Member Summary

    PeterO.Numbers.EDecimal bigValue);
    -

    Deprecated. Use FromEDecimal instead.

    -

    Generates a CBOR object from a decimal number.

    Parameters:

    @@ -3300,8 +2830,6 @@

    Member Summary

    PeterO.Numbers.EFloat bigValue);
    -

    Deprecated. Use FromEFloat instead.

    -

    Generates a CBOR object from an arbitrary-precision binary floating-point number.

    Parameters:

    @@ -3321,8 +2849,6 @@

    Member Summary

    PeterO.Numbers.EInteger bigintValue);
    -

    Deprecated. Use FromEInteger instead.

    -

    Generates a CBOR object from an arbitrary-precision integer.

    Parameters:

    @@ -3343,8 +2869,6 @@

    Member Summary

    PeterO.Numbers.ERational bigValue);
    -

    Deprecated. Use FromERational instead.

    -

    Generates a CBOR object from an arbitrary-precision rational number.

    Parameters:

    @@ -3364,273 +2888,43 @@

    Member Summary

    sbyte value);
    -

    Deprecated. Use FromSbyte instead

    - -

    This API is not CLS-compliant.

    - -

    Converts a signed 8-bit integer to a CBOR object.

    - -

    Parameters:

    - -
      -
    • value: The input.
    • -
    - -

    Return Value:

    - -

    A CBORObject object.

    - -

    -### FromObject

    - -
    public static PeterO.Cbor.CBORObject FromObject(
    -    short value);
    -
    - -

    Deprecated. Use FromInt16 instead.

    - -

    Generates a CBOR object from a 16-bit signed integer.

    - -

    Parameters:

    - -
      -
    • value: A 16-bit signed integer.
    • -
    - -

    Return Value:

    - -

    A CBOR object generated from the given integer.

    - -

    -### FromObject

    - -
    public static PeterO.Cbor.CBORObject FromObject(
    -    string strValue);
    -
    - -

    Deprecated. Use FromString instead.

    - -

    Generates a CBOR object from a text string.

    - -

    Parameters:

    - -
      -
    • strValue: A text string value. Can be null.
    • -
    - -

    Return Value:

    - -

    A CBOR object representing the string, or CBORObject.Null if stringValue is null.

    - -

    -### FromObject

    - -
    public static PeterO.Cbor.CBORObject FromObject(
    -    uint value);
    -
    - -

    Deprecated. Use FromUInt instead

    - -

    This API is not CLS-compliant.

    - -

    Converts a 32-bit unsigned integer to a CBOR object.

    - -

    Parameters:

    - -
      -
    • value: A 32-bit unsigned integer.
    • -
    - -

    Return Value:

    - -

    A CBORObject object.

    - -

    -### FromObject

    - -
    public static PeterO.Cbor.CBORObject FromObject(
    -    ulong value);
    -
    - -

    Deprecated. Use FromUInt64 instead

    - -

    This API is not CLS-compliant.

    - -

    Converts a 64-bit unsigned integer to a CBOR object.

    - -

    Parameters:

    - -
      -
    • value: A 64-bit unsigned integer.
    • -
    - -

    Return Value:

    - -

    A CBORObject object.

    - -

    -### FromObject

    - -
    public static PeterO.Cbor.CBORObject FromObject(
    -    ushort value);
    -
    - -

    Deprecated. Use FromUShort instead

    - -

    This API is not CLS-compliant.

    - -

    Converts a 16-bit unsigned integer to a CBOR object.

    - -

    Parameters:

    - -
      -
    • value: A 16-bit unsigned integer.
    • -
    - -

    Return Value:

    - -

    A CBORObject object.

    - -

    -### FromObjectAndTag

    - -
    public static PeterO.Cbor.CBORObject FromObjectAndTag(
    -    object valueObValue,
    -    int smallTag);
    -
    - -

    Deprecated. Use FromCBORObjectAndTag instead.

    - -

    Generates a CBOR object from an arbitrary object and gives the resulting object a tag in addition to its existing tags (the new tag is made the outermost tag).

    - -

    Parameters:

    - -
      -
    • -

      valueObValue: The parameter, an arbitrary object, which can be null.

      -
    • -
    • -

      smallTag: A 32-bit integer that specifies a tag number.

      -
    • -
    - -

    Return Value:

    - -

    A CBOR object where the object valueObValue - is given the tag smallTag -.

    - -

    Exceptions:

    - -
      -
    • System.ArgumentException: -The parameter smallTag - is less than 0.
    • -
    - -

    -### FromObjectAndTag

    - -
    public static PeterO.Cbor.CBORObject FromObjectAndTag(
    -    object valueObValue,
    -    PeterO.Numbers.EInteger bigintTag);
    -
    - -

    Deprecated. Use FromCBORObjectAndTag instead.

    - -

    Generates a CBOR object from an arbitrary object and gives the resulting object a tag in addition to its existing tags (the new tag is made the outermost tag).

    - -

    Parameters:

    - -
      -
    • -

      valueObValue: An arbitrary object, which can be null.

      -
    • -
    • -

      bigintTag: Tag number.

      -
    • -
    - -

    Return Value:

    - -

    A CBOR object where the object valueObValue - is given the tag bigintTag -.

    - -

    -### FromSbyte

    - -
    public static PeterO.Cbor.CBORObject FromSbyte(
    -    sbyte value);
    -
    -

    This API is not CLS-compliant.

    Converts a signed 8-bit integer to a CBOR object.

    -

    Parameters:

    - -
      -
    • value: The parameter value - is an 8-bit signed integer.
    • -
    - -

    Return Value:

    - -

    A CBORObject object.

    - -

    -### FromSimpleValue

    - -
    public static PeterO.Cbor.CBORObject FromSimpleValue(
    -    int simpleValue);
    -
    - -

    Creates a CBOR object from a simple value number.

    - -

    Parameters:

    - -
      -
    • simpleValue: The parameter simpleValue - is a 32-bit signed integer.
    • -
    - -

    Return Value:

    - -

    A CBOR object.

    - -

    Exceptions:

    +

    Parameters:

      -
    • System.ArgumentException: -The parameter simpleValue - is less than 0, greater than 255, or from 24 through 31.
    • +
    • value: The input.
    -

    -### FromSingle

    +

    Return Value:

    -
    public static PeterO.Cbor.CBORObject FromSingle(
    -    float value);
    +

    A CBORObject object.

    + +

    +### FromObject

    + +
    public static PeterO.Cbor.CBORObject FromObject(
    +    short value);
     
    -

    Generates a CBOR object from a 32-bit floating-point number. The input value can be a not-a-number (NaN) value (such as Single.NaN in DotNet or Float.NaN in Java); however, NaN values have multiple forms that are equivalent for many applications’ purposes, and Single.NaN / Float.NaN is only one of these equivalent forms. In fact, CBORObject.FromSingle(Single.NaN) or CBORObject.FromSingle(Float.NaN) could produce a CBOR-encoded object that differs between DotNet and Java, because Single.NaN / Float.NaN may have a different form in DotNet and Java (for example, the NaN value’s sign may be negative in DotNet, but positive in Java).

    +

    Generates a CBOR object from a 16-bit signed integer.

    Parameters:

      -
    • value: The parameter value - is a 32-bit floating-point number.
    • +
    • value: A 16-bit signed integer.

    Return Value:

    -

    A CBOR object generated from the given number.

    +

    A CBOR object generated from the given integer.

    -

    -### FromString

    +

    +### FromObject

    -
    public static PeterO.Cbor.CBORObject FromString(
    +
    public static PeterO.Cbor.CBORObject FromObject(
         string strValue);
     
    @@ -3646,17 +2940,10 @@

    Member Summary

    A CBOR object representing the string, or CBORObject.Null if stringValue is null.

    -

    Exceptions:

    - -
      -
    • System.ArgumentException: -The string contains an unpaired surrogate code point.
    • -
    - -

    -### FromUInt

    +

    +### FromObject

    -
    public static PeterO.Cbor.CBORObject FromUInt(
    +
    public static PeterO.Cbor.CBORObject FromObject(
         uint value);
     
    @@ -3674,10 +2961,10 @@

    Member Summary

    A CBORObject object.

    -

    -### FromUInt64

    +

    +### FromObject

    -
    public static PeterO.Cbor.CBORObject FromUInt64(
    +
    public static PeterO.Cbor.CBORObject FromObject(
         ulong value);
     
    @@ -3695,10 +2982,10 @@

    Member Summary

    A CBORObject object.

    -

    -### FromUShort

    +

    +### FromObject

    -
    public static PeterO.Cbor.CBORObject FromUShort(
    +
    public static PeterO.Cbor.CBORObject FromObject(
         ushort value);
     
    @@ -3716,123 +3003,138 @@

    Member Summary

    A CBORObject object.

    -

    -### GetAllTags

    - -
    public PeterO.Numbers.EInteger[] GetAllTags();
    -
    - -

    Gets a list of all tags, from outermost to innermost.

    - -

    Return Value:

    - -

    An array of tags, or the empty string if this object is untagged.

    - -

    -### GetByteString

    +

    +### FromObjectAndTag

    -
    public byte[] GetByteString();
    +
    public static PeterO.Cbor.CBORObject FromObjectAndTag(
    +    object valueOb,
    +    PeterO.Numbers.EInteger bigintTag);
     
    -

    Gets the backing byte array used in this CBOR object, if this object is a byte string, without copying the data to a new byte array. Any changes in the returned array’s contents will be reflected in this CBOR object. Note, though, that the array’s length can’t be changed.

    - -

    Return Value:

    - -

    The byte array held by this CBOR object.

    +

    Generates a CBOR object from an arbitrary object and gives the resulting object a tag in addition to its existing tags (the new tag is made the outermost tag).

    -

    Exceptions:

    +

    Parameters:

      -
    • System.InvalidOperationException: -This object is not a byte string.
    • +
    • +

      valueObValue: An arbitrary object, which can be null.

      +
    • +
    • +

      bigintTag: Tag number.

      +
    -

    -### GetHashCode

    - -
    public override int GetHashCode();
    -
    - -

    Calculates the hash code of this object. The hash code for a given instance of this class is not guaranteed to be the same across versions of this class, and no application or process IDs are used in the hash code calculation.

    -

    Return Value:

    -

    A 32-bit hash code.

    +

    A CBOR object where the object valueObValue + is given the tag bigintTag +.

    -

    -### GetOrDefault

    +

    +### FromObjectAndTag

    -
    public PeterO.Cbor.CBORObject GetOrDefault(
    -    int key,
    -    PeterO.Cbor.CBORObject defaultValue);
    +
    public static PeterO.Cbor.CBORObject FromObjectAndTag(
    +    object valueObValue,
    +    int smallTag);
     
    -

    Gets the value of a CBOR object by integer index in this array, or a default value if that value is not found.

    +

    Generates a CBOR object from an arbitrary object and gives the resulting object a tag in addition to its existing tags (the new tag is made the outermost tag).

    Parameters:

    • -

      key: An arbitrary object. If this is a CBOR map, this parameter is converted to a CBOR object serving as the key to the map or index to the array, and can be null. If this is a CBOR array, the key must be an integer 0 or greater and less than the size of the array, and may be any object convertible to a CBOR integer.

      +

      valueObValue: The parameter, an arbitrary object, which can be null.

    • -

      defaultValue: A value to return if an item with the given key doesn’t exist, or if the CBOR object is an array and the key is not an integer 0 or greater and less than the size of the array.

      +

      smallTag: A 32-bit integer that specifies a tag number.

    Return Value:

    -

    The CBOR object referred to by index or key in this array or map. If this is a CBOR map, returns null (not CBORObject.Null ) if an item with the given key doesn’t exist.

    +

    A CBOR object where the object valueObValue + is given the tag smallTag +.

    + +

    Exceptions:

    + +
      +
    • System.ArgumentException: +The parameter smallTag + is less than 0.
    • +
    -

    -### GetOrDefault

    +

    +### FromSimpleValue

    -
    public PeterO.Cbor.CBORObject GetOrDefault(
    -    PeterO.Cbor.CBORObject cborkey,
    -    PeterO.Cbor.CBORObject defaultValue);
    +
    public static PeterO.Cbor.CBORObject FromSimpleValue(
    +    int simpleValue);
     
    -

    Gets the value of a CBOR object by integer index in this array or by CBOR object key in this map, or a default value if that value is not found.

    +

    Creates a CBOR object from a simple value number.

    Parameters:

      -
    • -

      cborkey: An arbitrary CBORObject. If this is a CBOR map, this parameter is converted to a CBOR object serving as the key to the map or index to the array, and can be null. If this is a CBOR array, the key must be an integer 0 or greater and less than the size of the array, and may be any object convertible to a CBOR integer.

      -
    • -
    • -

      defaultValue: A value to return if an item with the given key doesn’t exist, or if the CBOR object is an array and the key is not an integer 0 or greater and less than the size of the array.

      -
    • +
    • simpleValue: The parameter simpleValue + is a 32-bit signed integer.

    Return Value:

    -

    The CBOR object referred to by index or key in this array or map. If this is a CBOR map, returns null (not CBORObject.Null ) if an item with the given key doesn’t exist.

    +

    A CBOR object.

    -

    -### GetOrDefault

    +

    Exceptions:

    -
    public PeterO.Cbor.CBORObject GetOrDefault(
    -    string key,
    -    PeterO.Cbor.CBORObject defaultValue);
    +
      +
    • System.ArgumentException: +The parameter simpleValue + is less than 0, greater than 255, or from 24 through 31.
    • +
    + +

    +### GetAllTags

    + +
    public PeterO.Numbers.EInteger[] GetAllTags();
     
    -

    Gets the value of a CBOR object by string key in a map, or a default value if that value is not found.

    +

    Gets a list of all tags, from outermost to innermost.

    -

    Parameters:

    +

    Return Value:

    + +

    An array of tags, or the empty string if this object is untagged.

    + +

    +### GetByteString

    + +
    public byte[] GetByteString();
    +
    + +

    Gets the backing byte array used in this CBOR object, if this object is a byte string, without copying the data to a new byte array. Any changes in the returned array’s contents will be reflected in this CBOR object. Note, though, that the array’s length can’t be changed.

    + +

    Return Value:

    + +

    The byte array held by this CBOR object.

    + +

    Exceptions:

      -
    • -

      key: An arbitrary string. If this is a CBOR map, this parameter is converted to a CBOR object serving as the key to the map or index to the array, and can be null. If this is a CBOR array, defaultValue is returned.

      -
    • -
    • -

      defaultValue: A value to return if an item with the given key doesn’t exist, or if the CBOR object is an array.

      -
    • +
    • System.InvalidOperationException: +This object is not a byte string.
    +

    +### GetHashCode

    + +
    public override int GetHashCode();
    +
    + +

    Calculates the hash code of this object. The hash code for a given instance of this class is not guaranteed to be the same across versions of this class, and no application or process IDs are used in the hash code calculation.

    +

    Return Value:

    -

    The CBOR object referred to by index or key in this array or map. If this is a CBOR map, returns null (not CBORObject.Null ) if an item with the given key doesn’t exist.

    +

    A 32-bit hash code.

    ### HasMostInnerTag

    @@ -4105,8 +3407,6 @@

    Member Summary

    object valueOb);
    -

    Deprecated. Use the CBORObject overload instead.

    -

    Inserts an object at the specified position in this CBOR array.

    Parameters:

    @@ -4139,45 +3439,6 @@

    Member Summary

    -

    -### Insert

    - -
    public PeterO.Cbor.CBORObject Insert(
    -    int index,
    -    PeterO.Cbor.CBORObject cborObj);
    -
    - -

    Inserts a CBORObject at the specified position in this CBOR array.

    - -

    Parameters:

    - -
      -
    • -

      index: Index starting at 0 to insert at.

      -
    • -
    • -

      cborObj: A CBORObject representing the value.

      -
    • -
    - -

    Return Value:

    - -

    This instance.

    - -

    Exceptions:

    - -
      -
    • -

      System.InvalidOperationException: -This object is not an array.

      -
    • -
    • -

      System.ArgumentException: -The parameter index - is not a valid index into this array.

      -
    • -
    -

    ### NewArray

    @@ -4747,38 +4008,6 @@

    Member Summary

    This object is not a CBOR array. -

    -### Set

    - -
    public PeterO.Cbor.CBORObject Set(
    -    int key,
    -    PeterO.Cbor.CBORObject mapValue);
    -
    - -

    Sets the value of a CBORObject of type Array at the given index to the given value.

    - -

    Parameters:

    - -
      -
    • -

      key: This parameter must be a 32-bit signed integer( int ) identifying the index (starting from 0) of the item to set in the array.

      -
    • -
    • -

      mapValue: An CBORObject representing the value.

      -
    • -
    - -

    Return Value:

    - -

    This instance.

    - -

    Exceptions:

    - -
      -
    • System.InvalidOperationException: -MapValue is not a an array.
    • -
    -

    ### Set

    @@ -4787,8 +4016,6 @@

    Member Summary

    object valueOb);
    -

    Deprecated. Use the CBORObject overload instead.

    -

    Maps an object to a key in this CBOR map, or adds the value if the key doesn’t exist. If this is a CBOR array, instead sets the value at the given index to the given value.

    Parameters:

    @@ -4822,45 +4049,6 @@

    Member Summary

    -

    -### Set

    - -
    public PeterO.Cbor.CBORObject Set(
    -    PeterO.Cbor.CBORObject mapKey,
    -    PeterO.Cbor.CBORObject mapValue);
    -
    - -

    Maps an object to a key in this CBOR map, or adds the value if the key doesn’t exist.

    - -

    Parameters:

    - -
      -
    • -

      mapKey: If this instance is a CBOR map, this parameter is an object representing the key, which will be converted to a CBORObject; in this case, this parameter can be null, in which case this value is converted to CBORObject.Null.

      -
    • -
    • -

      mapValue: A CBORObject representing the value, which should be of type CBORType.Map.

      -
    • -
    - -

    Return Value:

    - -

    This instance.

    - -

    Exceptions:

    - -
      -
    • -

      System.InvalidOperationException: -This object is not a map.

      -
    • -
    • -

      System.ArgumentException: -The parameter mapValue - or this instance is a CBOR array.

      -
    • -
    -

    ### ToJSONBytes

    @@ -4944,22 +4132,22 @@

    Member Summary

    The example code given below (originally written in C# for the.NET version) can be used to write out certain keys of a CBOR map in a given order to a JSON string.

    /* Generates a JSON string of 'mapObj' whose keys are in the order
    -             given
    -             in 'keys' . Only keys found in 'keys' will be written if they exist in
    -             'mapObj'. */ private static string KeysToJSONMap(CBORObject mapObj,
    -             IList<CBORObject> keys) { if (mapObj == null) { throw new
    -             ArgumentNullException)nameof(mapObj));}
    -             if (keys == null) { throw new
    -             ArgumentNullException)nameof(keys));}
    -             if (obj.Type != CBORType.Map) {
    -             throw new ArgumentException("'obj' is not a map."); } StringBuilder
    -             builder = new StringBuilder(); var first = true; builder.Append("{");
    -             for (CBORObject key in keys) { if (mapObj.ContainsKey(key)) { if
    -             (!first) {builder.Append(", ");} var keyString=(key.CBORType ==
    -             CBORType.String) ? key.AsString() : key.ToJSONString();
    -             builder.Append(CBORObject.FromObject(keyString) .ToJSONString())
    -             .Append(":").Append(mapObj[key].ToJSONString()); first=false; } } return
    -             builder.Append("}").ToString(); }
    +            given
    +            in 'keys' . Only keys found in 'keys' will be written if they exist in
    +            'mapObj'. */ private static string KeysToJSONMap(CBORObject mapObj,
    +            IList<CBORObject> keys) { if (mapObj == null) { throw new
    +            ArgumentNullException)nameof(mapObj));}
    +            if (keys == null) { throw new
    +            ArgumentNullException)nameof(keys));}
    +            if (obj.Type != CBORType.Map) {
    +            throw new ArgumentException("'obj' is not a map."); } StringBuilder
    +            builder = new StringBuilder(); var first = true; builder.Append("{");
    +            for (CBORObject key in keys) { if (mapObj.ContainsKey(key)) { if
    +            (!first) {builder.Append(", ");} var keyString=(key.CBORType ==
    +            CBORType.String) ? key.AsString() : key.ToJSONString();
    +            builder.Append(CBORObject.FromObject(keyString) .ToJSONString())
    +            .Append(":").Append(mapObj[key].ToJSONString()); first=false; } } return
    +            builder.Append("}").ToString(); }
     

    .

    diff --git a/CBOR/docs/PeterO.DataUtilities.html b/CBOR/docs/PeterO.DataUtilities.html index 157f9a073..92bcd8f15 100644 --- a/CBOR/docs/PeterO.DataUtilities.html +++ b/CBOR/docs/PeterO.DataUtilities.html @@ -5,6 +5,868 @@

    PeterO.DataUtilities

    +

    ## PeterO.DataUtilities

    + +
    public static class DataUtilities
    +
    + +

    Contains methods useful for reading and writing text strings. It is designed to have no dependencies other than the basic runtime class library. Many of these methods work with text encoded in UTF-8, an encoding form of the Unicode Standard which uses one byte to encode the most basic characters and two to four bytes to encode other characters. For example, the GetUtf8 method converts a text string to an array of bytes in UTF-8.

    + +

    In C# and Java, text strings are represented as sequences of 16-bit values called char s. These sequences are well-formed under UTF-16, a 16-bit encoding form of Unicode, except if they contain unpaired surrogate code points. (A surrogate code point is used to encode supplementary characters, those with code points U+10000 or higher, in UTF-16. A surrogate pair is a high surrogate, U+D800 to U+DBFF, followed by a low surrogate, U+DC00 to U+DFFF. An unpaired surrogate code point is a surrogate not appearing in a surrogate pair.) Many of the methods in this class allow setting the behavior to follow when unpaired surrogate code points are found in text strings, such as throwing an error or treating the unpaired surrogate as a replacement character (U+FFFD).

    + +

    Member Summary

    +
      +
    • [CodePointAt(string, int)](#CodePointAt_string_int) - Gets the Unicode code point at the given index of the string.
    • +
    • [CodePointAt(string, int, int)](#CodePointAt_string_int_int) - Gets the Unicode code point at the given index of the string.
    • +
    • [CodePointBefore(string, int)](#CodePointBefore_string_int) - Gets the Unicode code point just before the given index of the string.
    • +
    • [CodePointBefore(string, int, int)](#CodePointBefore_string_int_int) - Gets the Unicode code point just before the given index of the string.
    • +
    • [CodePointCompare(string, string)](#CodePointCompare_string_string) - Compares two strings in Unicode code point order.
    • +
    • [CodePointLength(string)](#CodePointLength_string) - Finds the number of Unicode code points in the given text string.
    • +
    • [GetUtf8Bytes(string, bool)](#GetUtf8Bytes_string_bool) - Encodes a string in UTF-8 as a byte array.
    • +
    • [GetUtf8Bytes(string, bool, bool)](#GetUtf8Bytes_string_bool_bool) - Encodes a string in UTF-8 as a byte array.
    • +
    • [GetUtf8Length(string, bool)](#GetUtf8Length_string_bool) - Calculates the number of bytes needed to encode a string in UTF-8.
    • +
    • [GetUtf8String(byte[], bool)](#GetUtf8String_byte_bool) - Generates a text string from a UTF-8 byte array.
    • +
    • [GetUtf8String(byte[], int, int, bool)](#GetUtf8String_byte_int_int_bool) - Generates a text string from a portion of a UTF-8 byte array.
    • +
    • [ReadUtf8(System.IO.Stream, int, System.Text.StringBuilder, bool)](#ReadUtf8_System_IO_Stream_int_System_Text_StringBuilder_bool) - Reads a string in UTF-8 encoding from a data stream.
    • +
    • [ReadUtf8FromBytes(byte[], int, int, System.Text.StringBuilder, bool)](#ReadUtf8FromBytes_byte_int_int_System_Text_StringBuilder_bool) - Reads a string in UTF-8 encoding from a byte array.
    • +
    • [ReadUtf8ToString(System.IO.Stream)](#ReadUtf8ToString_System_IO_Stream) - Reads a string in UTF-8 encoding from a data stream in full and returns that string.
    • +
    • [ReadUtf8ToString(System.IO.Stream, int, bool)](#ReadUtf8ToString_System_IO_Stream_int_bool) - Reads a string in UTF-8 encoding from a data stream and returns that string.
    • +
    • [ToLowerCaseAscii(string)](#ToLowerCaseAscii_string) - Returns a string with the basic upper-case letters A to Z (U+0041 to U+005A) converted to the corresponding basic lower-case letters.
    • +
    • [ToUpperCaseAscii(string)](#ToUpperCaseAscii_string) - Returns a string with the basic lower-case letters A to Z (U+0061 to U+007A) converted to the corresponding basic upper-case letters.
    • +
    • [WriteUtf8(string, int, int, System.IO.Stream, bool)](#WriteUtf8_string_int_int_System_IO_Stream_bool) - Writes a portion of a string in UTF-8 encoding to a data stream.
    • +
    • [WriteUtf8(string, int, int, System.IO.Stream, bool, bool)](#WriteUtf8_string_int_int_System_IO_Stream_bool_bool) - Writes a portion of a string in UTF-8 encoding to a data stream.
    • +
    • [WriteUtf8(string, System.IO.Stream, bool)](#WriteUtf8_string_System_IO_Stream_bool) - Writes a string in UTF-8 encoding to a data stream.
    • +
    + +

    +### CodePointAt

    + +
    public static int CodePointAt(
    +    string str,
    +    int index);
    +
    + +

    Gets the Unicode code point at the given index of the string.

    + +

    Parameters:

    + +
      +
    • +

      str: The parameter str + is a text string.

      +
    • +
    • +

      index: Index of the current position into the string.

      +
    • +
    + +

    Return Value:

    + +

    The Unicode code point at the given position. Returns -1 if index + is 0 or less, or is greater than or equal to the string’s length. Returns the replacement character (U+FFFD) if the code point at that position is an unpaired surrogate code point. If the return value is 65536 (0x10000) or greater, the code point takes up two UTF-16 code units.

    + +

    Exceptions:

    + +
      +
    • System.ArgumentNullException: +The parameter str + is null.
    • +
    + +

    +### CodePointAt

    + +
    public static int CodePointAt(
    +    string str,
    +    int index,
    +    int surrogateBehavior);
    +
    + +

    Gets the Unicode code point at the given index of the string.

    + +

    The following example shows how to iterate a text string code point by code point, terminating the loop when an unpaired surrogate is found.

    + +
    for (var i = 0;i<str.Length; ++i) { int codePoint =
    +            DataUtilities.CodePointAt(str, i, 2); if (codePoint < 0) { break; /*
    +            Unpaired surrogate */ } Console.WriteLine("codePoint:"+codePoint); if
    +            (codePoint >= 0x10000) { i++; /* Supplementary code point */ } }
    +
    + +

    .

    + +

    Parameters:

    + +
      +
    • +

      str: The parameter str + is a text string.

      +
    • +
    • +

      index: Index of the current position into the string.

      +
    • +
    • +

      surrogateBehavior: Specifies what kind of value to return if the code point at the given index is an unpaired surrogate code point: if 0, return the replacement character (U + FFFD); if 1, return the value of the surrogate code point; if neither 0 nor 1, return -1.

      +
    • +
    + +

    Return Value:

    + +

    The Unicode code point at the given position. Returns -1 if index + is 0 or less, or is greater than or equal to the string’s length. Returns a value as specified under surrogateBehavior + if the code point at that position is an unpaired surrogate code point. If the return value is 65536 (0x10000) or greater, the code point takes up two UTF-16 code units.

    + +

    Exceptions:

    + +
      +
    • System.ArgumentNullException: +The parameter str + is null.
    • +
    + +

    +### CodePointBefore

    + +
    public static int CodePointBefore(
    +    string str,
    +    int index);
    +
    + +

    Gets the Unicode code point just before the given index of the string.

    + +

    Parameters:

    + +
      +
    • +

      str: The parameter str + is a text string.

      +
    • +
    • +

      index: Index of the current position into the string.

      +
    • +
    + +

    Return Value:

    + +

    The Unicode code point at the previous position. Returns -1 if index + is 0 or less, or is greater than or equal to the string’s length. Returns the replacement character (U+FFFD) if the code point at the previous position is an unpaired surrogate code point. If the return value is 65536 (0x10000) or greater, the code point takes up two UTF-16 code units.

    + +

    Exceptions:

    + +
      +
    • System.ArgumentNullException: +The parameter str + is null.
    • +
    + +

    +### CodePointBefore

    + +
    public static int CodePointBefore(
    +    string str,
    +    int index,
    +    int surrogateBehavior);
    +
    + +

    Gets the Unicode code point just before the given index of the string.

    + +

    Parameters:

    + +
      +
    • +

      str: The parameter str + is a text string.

      +
    • +
    • +

      index: Index of the current position into the string.

      +
    • +
    • +

      surrogateBehavior: Specifies what kind of value to return if the previous code point is an unpaired surrogate code point: if 0, return the replacement character (U+FFFD); if 1, return the value of the surrogate code point; if neither 0 nor 1, return -1.

      +
    • +
    + +

    Return Value:

    + +

    The Unicode code point at the previous position. Returns -1 if index + is 0 or less, or is greater than or equal to the string’s length. Returns a value as specified under surrogateBehavior + if the code point at the previous position is an unpaired surrogate code point. If the return value is 65536 (0x10000) or greater, the code point takes up two UTF-16 code units.

    + +

    Exceptions:

    + +
      +
    • System.ArgumentNullException: +The parameter str + is null.
    • +
    + +

    +### CodePointCompare

    + +
    public static int CodePointCompare(
    +    string strA,
    +    string strB);
    +
    + +

    Compares two strings in Unicode code point order. Unpaired surrogate code points are treated as individual code points.

    + +

    Parameters:

    + +
      +
    • +

      strA: The first string. Can be null.

      +
    • +
    • +

      strB: The second string. Can be null.

      +
    • +
    + +

    Return Value:

    + +

    A value indicating which string is “ less” or “ greater” . 0: Both strings are equal or null. Less than 0: a is null and b isn’t; or the first code point that’s different is less in A than in B; or b starts with a and is longer than a. Greater than 0: b is null and a isn’t; or the first code point that’s different is greater in A than in B; or a starts with b and is longer than b.

    + +

    +### CodePointLength

    + +
    public static int CodePointLength(
    +    string str);
    +
    + +

    Finds the number of Unicode code points in the given text string. Unpaired surrogate code points increase this number by 1. This is not necessarily the length of the string in “char” s.

    + +

    Parameters:

    + +
      +
    • str: The parameter str + is a text string.
    • +
    + +

    Return Value:

    + +

    The number of Unicode code points in the given string.

    + +

    Exceptions:

    + +
      +
    • System.ArgumentNullException: +The parameter str + is null.
    • +
    + +

    +### GetUtf8Bytes

    + +
    public static byte[] GetUtf8Bytes(
    +    string str,
    +    bool replace);
    +
    + +

    Encodes a string in UTF-8 as a byte array. This method does not insert a byte-order mark (U+FEFF) at the beginning of the encoded byte array.

    + +

    REMARK: It is not recommended to use Encoding.UTF8.GetBytes in.NET, or the getBytes() method in Java to do this. For instance, getBytes() encodes text strings in a default (so not fixed) character encoding, which can be undesirable.

    + +

    Parameters:

    + +
      +
    • +

      str: The parameter str + is a text string.

      +
    • +
    • +

      replace: If true, replaces unpaired surrogate code points with the replacement character (U+FFFD). If false, stops processing when an unpaired surrogate code point is seen.

      +
    • +
    + +

    Return Value:

    + +

    The string encoded in UTF-8.

    + +

    Exceptions:

    + +
      +
    • +

      System.ArgumentNullException: +The parameter str + is null.

      +
    • +
    • +

      System.ArgumentException: +The string contains an unpaired surrogate code point and replace + is false, or an internal error occurred.

      +
    • +
    + +

    +### GetUtf8Bytes

    + +
    public static byte[] GetUtf8Bytes(
    +    string str,
    +    bool replace,
    +    bool lenientLineBreaks);
    +
    + +

    Encodes a string in UTF-8 as a byte array. This method does not insert a byte-order mark (U+FEFF) at the beginning of the encoded byte array.

    + +

    REMARK: It is not recommended to use Encoding.UTF8.GetBytes in.NET, or the getBytes() method in Java to do this. For instance, getBytes() encodes text strings in a default (so not fixed) character encoding, which can be undesirable.

    + +

    Parameters:

    + +
      +
    • +

      str: The parameter str + is a text string.

      +
    • +
    • +

      replace: If true, replaces unpaired surrogate code points with the replacement character (U+FFFD). If false, stops processing when an unpaired surrogate code point is seen.

      +
    • +
    • +

      lenientLineBreaks: If true, replaces carriage return (CR) not followed by line feed (LF) and LF not preceded by CR with CR-LF pairs.

      +
    • +
    + +

    Return Value:

    + +

    The string encoded in UTF-8.

    + +

    Exceptions:

    + +
      +
    • +

      System.ArgumentNullException: +The parameter str + is null.

      +
    • +
    • +

      System.ArgumentException: +The string contains an unpaired surrogate code point and replace + is false, or an internal error occurred.

      +
    • +
    + +

    +### GetUtf8Length

    + +
    public static long GetUtf8Length(
    +    string str,
    +    bool replace);
    +
    + +

    Calculates the number of bytes needed to encode a string in UTF-8.

    + +

    Parameters:

    + +
      +
    • +

      str: The parameter str + is a text string.

      +
    • +
    • +

      replace: If true, treats unpaired surrogate code points as having 3 UTF-8 bytes (the UTF-8 length of the replacement character U+FFFD).

      +
    • +
    + +

    Return Value:

    + +

    The number of bytes needed to encode the given string in UTF-8, or -1 if the string contains an unpaired surrogate code point and replace + is false.

    + +

    Exceptions:

    + +
      +
    • System.ArgumentNullException: +The parameter str + is null.
    • +
    + +

    +### GetUtf8String

    + +
    public static string GetUtf8String(
    +    byte[] bytes,
    +    bool replace);
    +
    + +

    Generates a text string from a UTF-8 byte array.

    + +

    Parameters:

    + +
      +
    • +

      bytes: A byte array containing text encoded in UTF-8.

      +
    • +
    • +

      replace: If true, replaces invalid encoding with the replacement character (U+FFFD). If false, stops processing when invalid UTF-8 is seen.

      +
    • +
    + +

    Return Value:

    + +

    A string represented by the UTF-8 byte array.

    + +

    Exceptions:

    + +
      +
    • +

      System.ArgumentNullException: +The parameter bytes + is null.

      +
    • +
    • +

      System.ArgumentException: +The string is not valid UTF-8 and replace + is false.

      +
    • +
    + +

    +### GetUtf8String

    + +
    public static string GetUtf8String(
    +    byte[] bytes,
    +    int offset,
    +    int bytesCount,
    +    bool replace);
    +
    + +

    Generates a text string from a portion of a UTF-8 byte array.

    + +

    Parameters:

    + +
      +
    • +

      bytes: A byte array containing text encoded in UTF-8.

      +
    • +
    • +

      offset: Offset into the byte array to start reading.

      +
    • +
    • +

      bytesCount: Length, in bytes, of the UTF-8 text string.

      +
    • +
    • +

      replace: If true, replaces invalid encoding with the replacement character (U+FFFD). If false, stops processing when invalid UTF-8 is seen.

      +
    • +
    + +

    Return Value:

    + +

    A string represented by the UTF-8 byte array.

    + +

    Exceptions:

    + +
      +
    • +

      System.ArgumentNullException: +The parameter bytes + is null.

      +
    • +
    • +

      System.ArgumentException: +The portion of the byte array is not valid UTF-8 and replace + is false.

      +
    • +
    • +

      System.ArgumentException: +The parameter offset + is less than 0, bytesCount + is less than 0, or offset plus bytesCount is greater than the length of “data” .

      +
    • +
    + +

    +### ReadUtf8

    + +
    public static int ReadUtf8(
    +    System.IO.Stream stream,
    +    int bytesCount,
    +    System.Text.StringBuilder builder,
    +    bool replace);
    +
    + +

    Reads a string in UTF-8 encoding from a data stream.

    + +

    Parameters:

    + +
      +
    • +

      stream: A readable data stream.

      +
    • +
    • +

      bytesCount: The length, in bytes, of the string. If this is less than 0, this function will read until the end of the stream.

      +
    • +
    • +

      builder: A string builder object where the resulting string will be stored.

      +
    • +
    • +

      replace: If true, replaces invalid encoding with the replacement character (U+FFFD). If false, stops processing when an unpaired surrogate code point is seen.

      +
    • +
    + +

    Return Value:

    + +

    0 if the entire string was read without errors, -1 if the string is not valid UTF-8 and replace + is false, or -2 if the end of the stream was reached before the last character was read completely (which is only the case if bytesCount + is 0 or greater).

    + +

    Exceptions:

    + +
      +
    • +

      System.IO.IOException: +An I/O error occurred.

      +
    • +
    • +

      System.ArgumentNullException: +The parameter stream + is null or builder + is null.

      +
    • +
    + +

    +### ReadUtf8FromBytes

    + +
    public static int ReadUtf8FromBytes(
    +    byte[] data,
    +    int offset,
    +    int bytesCount,
    +    System.Text.StringBuilder builder,
    +    bool replace);
    +
    + +

    Reads a string in UTF-8 encoding from a byte array.

    + +

    Parameters:

    + +
      +
    • +

      data: A byte array containing a UTF-8 text string.

      +
    • +
    • +

      offset: Offset into the byte array to start reading.

      +
    • +
    • +

      bytesCount: Length, in bytes, of the UTF-8 text string.

      +
    • +
    • +

      builder: A string builder object where the resulting string will be stored.

      +
    • +
    • +

      replace: If true, replaces invalid encoding with the replacement character (U+FFFD). If false, stops processing when invalid UTF-8 is seen.

      +
    • +
    + +

    Return Value:

    + +

    0 if the entire string was read without errors, or -1 if the string is not valid UTF-8 and replace + is false.

    + +

    Exceptions:

    + +
      +
    • +

      System.ArgumentNullException: +The parameter data + is null or builder + is null.

      +
    • +
    • +

      System.ArgumentException: +The parameter offset + is less than 0, bytesCount + is less than 0, or offset plus bytesCount is greater than the length of data +.

      +
    • +
    + +

    +### ReadUtf8ToString

    + +
    public static string ReadUtf8ToString(
    +    System.IO.Stream stream);
    +
    + +

    Reads a string in UTF-8 encoding from a data stream in full and returns that string. Replaces invalid encoding with the replacement character (U+FFFD).

    + +

    Parameters:

    + +
      +
    • stream: A readable data stream.
    • +
    + +

    Return Value:

    + +

    The string read.

    + +

    Exceptions:

    + +
      +
    • +

      System.IO.IOException: +An I/O error occurred.

      +
    • +
    • +

      System.ArgumentNullException: +The parameter stream + is null.

      +
    • +
    + +

    +### ReadUtf8ToString

    + +
    public static string ReadUtf8ToString(
    +    System.IO.Stream stream,
    +    int bytesCount,
    +    bool replace);
    +
    + +

    Reads a string in UTF-8 encoding from a data stream and returns that string.

    + +

    Parameters:

    + +
      +
    • +

      stream: A readable data stream.

      +
    • +
    • +

      bytesCount: The length, in bytes, of the string. If this is less than 0, this function will read until the end of the stream.

      +
    • +
    • +

      replace: If true, replaces invalid encoding with the replacement character (U+FFFD). If false, throws an error if an unpaired surrogate code point is seen.

      +
    • +
    + +

    Return Value:

    + +

    The string read.

    + +

    Exceptions:

    + +
      +
    • +

      System.IO.IOException: +An I/O error occurred; or, the string is not valid UTF-8 and replace + is false.

      +
    • +
    • +

      System.ArgumentNullException: +The parameter stream + is null.

      +
    • +
    + +

    +### ToLowerCaseAscii

    + +
    public static string ToLowerCaseAscii(
    +    string str);
    +
    + +

    Returns a string with the basic upper-case letters A to Z (U+0041 to U+005A) converted to the corresponding basic lower-case letters. Other characters remain unchanged.

    + +

    Parameters:

    + +
      +
    • str: The parameter str + is a text string.
    • +
    + +

    Return Value:

    + +

    The converted string, or null if str + is null.

    + +

    +### ToUpperCaseAscii

    + +
    public static string ToUpperCaseAscii(
    +    string str);
    +
    + +

    Returns a string with the basic lower-case letters A to Z (U+0061 to U+007A) converted to the corresponding basic upper-case letters. Other characters remain unchanged.

    + +

    Parameters:

    + +
      +
    • str: The parameter str + is a text string.
    • +
    + +

    Return Value:

    + +

    The converted string, or null if str + is null.

    + +

    +### WriteUtf8

    + +
    public static int WriteUtf8(
    +    string str,
    +    int offset,
    +    int length,
    +    System.IO.Stream stream,
    +    bool replace);
    +
    + +

    Writes a portion of a string in UTF-8 encoding to a data stream.

    + +

    Parameters:

    + +
      +
    • +

      str: A string to write.

      +
    • +
    • +

      offset: The Index starting at 0 where the string portion to write begins.

      +
    • +
    • +

      length: The length of the string portion to write.

      +
    • +
    • +

      stream: A writable data stream.

      +
    • +
    • +

      replace: If true, replaces unpaired surrogate code points with the replacement character (U+FFFD). If false, stops processing when an unpaired surrogate code point is seen.

      +
    • +
    + +

    Return Value:

    + +

    0 if the entire string portion was written; or -1 if the string portion contains an unpaired surrogate code point and replace + is false.

    + +

    Exceptions:

    + +
      +
    • +

      System.ArgumentNullException: +The parameter str + is null or stream + is null.

      +
    • +
    • +

      System.IO.IOException: +An I/O error occurred.

      +
    • +
    • +

      System.ArgumentException: +Either offset + or length + is less than 0 or greater than str + ‘s length, or str + ‘s length minus offset + is less than length +.

      +
    • +
    + +

    +### WriteUtf8

    + +
    public static int WriteUtf8(
    +    string str,
    +    int offset,
    +    int length,
    +    System.IO.Stream stream,
    +    bool replace,
    +    bool lenientLineBreaks);
    +
    + +

    Writes a portion of a string in UTF-8 encoding to a data stream.

    + +

    Parameters:

    + +
      +
    • +

      str: A string to write.

      +
    • +
    • +

      offset: The Index starting at 0 where the string portion to write begins.

      +
    • +
    • +

      length: The length of the string portion to write.

      +
    • +
    • +

      stream: A writable data stream.

      +
    • +
    • +

      replace: If true, replaces unpaired surrogate code points with the replacement character (U+FFFD). If false, stops processing when an unpaired surrogate code point is seen.

      +
    • +
    • +

      lenientLineBreaks: If true, replaces carriage return (CR) not followed by line feed (LF) and LF not preceded by CR with CR-LF pairs.

      +
    • +
    + +

    Return Value:

    + +

    0 if the entire string portion was written; or -1 if the string portion contains an unpaired surrogate code point and replace + is false.

    + +

    Exceptions:

    + +
      +
    • +

      System.ArgumentNullException: +The parameter str + is null or stream + is null.

      +
    • +
    • +

      System.ArgumentException: +The parameter offset + is less than 0, length + is less than 0, or offset + plus length + is greater than the string’s length.

      +
    • +
    • +

      System.IO.IOException: +An I/O error occurred.

      +
    • +
    + +

    +### WriteUtf8

    + +
    public static int WriteUtf8(
    +    string str,
    +    System.IO.Stream stream,
    +    bool replace);
    +
    + +

    Writes a string in UTF-8 encoding to a data stream.

    + +

    Parameters:

    + +
      +
    • +

      str: A string to write.

      +
    • +
    • +

      stream: A writable data stream.

      +
    • +
    • +

      replace: If true, replaces unpaired surrogate code points with the replacement character (U+FFFD). If false, stops processing when an unpaired surrogate code point is seen.

      +
    • +
    + +

    Return Value:

    + +

    0 if the entire string was written; or -1 if the string contains an unpaired surrogate code point and replace + is false.

    + +

    Exceptions:

    + +
      +
    • +

      System.ArgumentNullException: +The parameter str + is null or stream + is null.

      +
    • +
    • +

      System.IO.IOException: +An I/O error occurred.

      +
    • +

    Back to CBOR start page.

    -

    NOTE: All code samples in this section are released under the Unlicense.

    +

    NOTE: All code samples in this section are released to the Public Domain, +as explained in https://creativecommons.org/publicdomain/zero/1.0/.

    Demo

    @@ -293,7 +297,7 @@

    Demo

    About

    -

    Written by Peter O.

    +

    Written in 2013-2019 by Peter O.

    Any copyright to this work is released to the Public Domain. In case this is not possible, this work is also @@ -310,7 +314,7 @@

    Specifications

    diff --git a/sitemap.xml b/sitemap.xml index f52624440..47a30a227 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -350,28 +350,28 @@ https://peteroupc.github.io/CBOR/bigfrac.html2021-05-28T19:26:12Z https://peteroupc.github.io/CBOR/binarymime.html2021-05-28T19:26:12Z https://peteroupc.github.io/CBOR/extended.html2021-05-28T19:26:12Z -https://peteroupc.github.io/CBOR/index.html2024-08-08T09:58:34Z +https://peteroupc.github.io/CBOR/index.html2024-08-15T16:54:27Z https://peteroupc.github.io/CBOR/iri.html2021-05-28T19:26:12Z https://peteroupc.github.io/CBOR/rational.html2021-05-28T19:26:12Z https://peteroupc.github.io/CBOR/rationalv1.html2021-05-28T19:26:12Z https://peteroupc.github.io/CBOR/api/Home.html2024-04-27T05:23:05Z -https://peteroupc.github.io/CBOR/api/com.upokecenter.cbor.CBORDataUtilities.html2024-04-27T05:23:05Z +https://peteroupc.github.io/CBOR/api/com.upokecenter.cbor.CBORDataUtilities.html2024-08-15T16:54:27Z https://peteroupc.github.io/CBOR/api/com.upokecenter.cbor.CBOREncodeOptions.html2024-04-27T05:23:05Z https://peteroupc.github.io/CBOR/api/com.upokecenter.cbor.CBORException.html2024-04-27T05:23:05Z https://peteroupc.github.io/CBOR/api/com.upokecenter.cbor.CBORNumber.NumberKind.html2024-04-27T05:23:05Z https://peteroupc.github.io/CBOR/api/com.upokecenter.cbor.CBORNumber.html2024-04-27T05:23:05Z -https://peteroupc.github.io/CBOR/api/com.upokecenter.cbor.CBORObject.html2024-07-21T08:59:36Z +https://peteroupc.github.io/CBOR/api/com.upokecenter.cbor.CBORObject.html2024-08-15T16:54:27Z https://peteroupc.github.io/CBOR/api/com.upokecenter.cbor.CBORType.html2024-04-27T05:23:05Z https://peteroupc.github.io/CBOR/api/com.upokecenter.cbor.CBORTypeMapper.html2024-04-27T05:23:05Z https://peteroupc.github.io/CBOR/api/com.upokecenter.cbor.ICBORConverter.html2024-04-27T05:23:05Z https://peteroupc.github.io/CBOR/api/com.upokecenter.cbor.ICBORToFromConverter.html2024-04-27T05:23:05Z https://peteroupc.github.io/CBOR/api/com.upokecenter.cbor.JSONOptions.ConversionMode.html2024-04-27T05:23:05Z -https://peteroupc.github.io/CBOR/api/com.upokecenter.cbor.JSONOptions.html2024-04-27T05:23:05Z -https://peteroupc.github.io/CBOR/api/com.upokecenter.cbor.PODOptions.html2024-04-27T05:23:05Z +https://peteroupc.github.io/CBOR/api/com.upokecenter.cbor.JSONOptions.html2024-08-15T16:54:27Z +https://peteroupc.github.io/CBOR/api/com.upokecenter.cbor.PODOptions.html2024-08-15T16:54:27Z https://peteroupc.github.io/CBOR/api/com.upokecenter.util.DataUtilities.html2024-04-27T05:23:05Z https://peteroupc.github.io/CBOR/api/index.html2024-04-27T05:23:05Z https://peteroupc.github.io/CBOR/api/com.upokecenter.cbor.CBORDateConverter.ConversionType.html2024-04-27T05:23:05Z -https://peteroupc.github.io/CBOR/api/com.upokecenter.cbor.CBORDateConverter.html2024-04-27T05:23:05Z +https://peteroupc.github.io/CBOR/api/com.upokecenter.cbor.CBORDateConverter.html2024-08-15T16:54:27Z https://peteroupc.github.io/CBOR/docs/PeterO.Cbor.CBORDateConverter.ConversionType.html2024-04-27T05:23:09Z https://peteroupc.github.io/CBOR/docs/APIDocs.html2024-04-27T05:23:09Z https://peteroupc.github.io/CBOR/docs/PeterO.BigInteger.html2023-03-20T06:26:05Z @@ -380,7 +380,7 @@ https://peteroupc.github.io/CBOR/docs/PeterO.Cbor.CBORException.html2024-04-27T05:23:09Z https://peteroupc.github.io/CBOR/docs/PeterO.Cbor.CBORNumber.NumberKind.html2024-04-27T05:23:09Z https://peteroupc.github.io/CBOR/docs/PeterO.Cbor.CBORNumber.html2024-04-27T05:23:09Z -https://peteroupc.github.io/CBOR/docs/PeterO.Cbor.CBORObject.html2024-04-27T05:23:09Z +https://peteroupc.github.io/CBOR/docs/PeterO.Cbor.CBORObject.html2024-08-15T16:53:10Z https://peteroupc.github.io/CBOR/docs/PeterO.Cbor.CBORType.html2024-04-27T05:23:09Z https://peteroupc.github.io/CBOR/docs/PeterO.Cbor.CBORTypeFilter.html2023-03-20T06:26:05Z https://peteroupc.github.io/CBOR/docs/PeterO.Cbor.CBORTypeMapper.html2024-04-27T05:23:09Z @@ -392,7 +392,7 @@ https://peteroupc.github.io/CBOR/docs/PeterO.Cbor.JSONOptions.ConversionMode.html2024-04-27T05:23:09Z https://peteroupc.github.io/CBOR/docs/PeterO.Cbor.JSONOptions.html2024-04-27T05:23:09Z https://peteroupc.github.io/CBOR/docs/PeterO.Cbor.PODOptions.html2024-04-27T05:23:10Z -https://peteroupc.github.io/CBOR/docs/PeterO.DataUtilities.html2023-12-14T05:41:36Z +https://peteroupc.github.io/CBOR/docs/PeterO.DataUtilities.html2024-08-15T16:53:10Z https://peteroupc.github.io/CBOR/docs/PeterO.ExtendedDecimal.html2023-03-20T06:26:05Z https://peteroupc.github.io/CBOR/docs/PeterO.ExtendedFloat.html2023-03-20T06:26:05Z https://peteroupc.github.io/CBOR/docs/PeterO.ExtendedRational.html2023-03-20T06:26:05Z @@ -605,5 +605,5 @@ https://peteroupc.github.io/usage.html2024-08-14T12:32:32Z https://peteroupc.github.io/randomgen.zip2024-08-08T09:58:14Z https://peteroupc.github.io/colorutil.zip2024-08-08T09:58:14Z -https://peteroupc.github.io/bernoulli.zip2024-08-15T15:04:11Z +https://peteroupc.github.io/bernoulli.zip2024-08-15T16:55:00Z