PeterO.Cbor.CBORDataUtilities

## PeterO.Cbor.CBORDataUtilities

public static class CBORDataUtilities

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

Member Summary

### ParseJSONNumber

public static PeterO.Cbor.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.

Parameters:

Return Value:

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

### ParseJSONNumber

public static PeterO.Cbor.CBORObject ParseJSONNumber(
    byte[] bytes,
    int offset,
    int count);

Parses a number whose format follows the JSON specification (RFC 8259) from a portion of a byte sequence, and converts that number to a CBOR object.

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

Parameters:

Return Value:

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

Exceptions:

### ParseJSONNumber

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

Parses a number from a byte sequence whose format follows the JSON specification (RFC 8259) and converts that number to a CBOR object.

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

Parameters:

Return Value:

A CBOR object that represents the parsed number. Returns null if the parsing fails, including if the byte sequence is null or empty or count is 0 or less.

Exceptions:

### ParseJSONNumber

public static PeterO.Cbor.CBORObject ParseJSONNumber(
    byte[] bytes,
    PeterO.Cbor.JSONOptions options);

Parses a number from a byte sequence whose format follows the JSON specification (RFC 8259) and converts that number to a CBOR object.

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

Parameters:

Return Value:

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

### ParseJSONNumber

public static PeterO.Cbor.CBORObject ParseJSONNumber(
    char[] chars);

Parses a number from a sequence of char s whose format follows the JSON specification. The method uses a JSONOptions with all default properties.

Parameters:

Return Value:

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.

### ParseJSONNumber

public static PeterO.Cbor.CBORObject ParseJSONNumber(
    char[] chars,
    int offset,
    int count);

Parses a number whose format follows the JSON specification (RFC 8259) from a portion of a sequence of char s, and converts that number to a CBOR object.

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 sequence of char s representing a valid JSON number is not allowed to contain white space characters, including spaces.

Parameters:

Return Value:

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.

Exceptions:

### ParseJSONNumber

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

Parses a number from a sequence of char s whose format follows the JSON specification (RFC 8259) and converts that number to a CBOR object.

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 sequence of char s representing a valid JSON number is not allowed to contain white space characters, including spaces.

Parameters:

Return Value:

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 or count is 0 or less.

Exceptions:

### ParseJSONNumber

public static PeterO.Cbor.CBORObject ParseJSONNumber(
    char[] chars,
    PeterO.Cbor.JSONOptions options);

Parses a number from a sequence of char s whose format follows the JSON specification (RFC 8259) and converts that number to a CBOR object.

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 sequence of char s representing a valid JSON number is not allowed to contain white space characters, including spaces.

Parameters:

Return Value:

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.

### ParseJSONNumber

public static PeterO.Cbor.CBORObject ParseJSONNumber(
    string str);

Parses a number whose format follows the JSON specification. The method uses a JSONOptions with all default properties.

Parameters:

Return Value:

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

### ParseJSONNumber

public static PeterO.Cbor.CBORObject ParseJSONNumber(
    string str,
    int offset,
    int count);

Parses a number whose format follows the JSON specification (RFC 8259) from a portion of a text string, and converts that number to a CBOR object.

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:

Return Value:

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

Exceptions:

### ParseJSONNumber

public static PeterO.Cbor.CBORObject ParseJSONNumber(
    string str,
    int offset,
    int count,
    PeterO.Cbor.JSONOptions options);

Parses a number whose format follows the JSON specification (RFC 8259) and converts that number to a CBOR object.

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:

Return Value:

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

Exceptions:

### ParseJSONNumber

public static PeterO.Cbor.CBORObject ParseJSONNumber(
    string str,
    PeterO.Cbor.JSONOptions options);

Parses a number whose format follows the JSON specification (RFC 8259) and converts that number to a CBOR object.

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:

Return Value:

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

Back to CBOR start page.