Table of Contents

Class AvroLogicalValues

Namespace
AvroSharp.Serialization
Assembly
AvroSharp.dll

Conversions between Avro logical types and .NET types, used by generated serializers and available for the generic model (whose values are the underlying types).

public static class AvroLogicalValues
Inheritance
AvroLogicalValues
Inherited Members

Remarks

Dates, times and timestamps written from .NET values are truncated towards negative infinity to the logical type's precision (a timestamp-millis drops sub-millisecond ticks), as the Java implementation does. Values read that do not fit the .NET type raise AvroDataException.

Decimals are exact: writing a value with more fractional digits than the schema's scale, or more digits than its precision, raises AvroException instead of rounding.

Methods

DateFromDays(int)

Converts a date (days since the Unix epoch) to a DateTime at midnight.

DaysFromDate(DateTime)

Converts a date to a date (days since the Unix epoch); the time of day is ignored.

LocalTimestampFromMicroseconds(long)

Converts a local-timestamp-micros to a DateTime of unspecified kind.

LocalTimestampFromMilliseconds(long)

Converts a local-timestamp-millis to a DateTime of unspecified kind.

MicrosecondsFromLocalTimestamp(DateTime)

Converts a wall-clock time to a local-timestamp-micros; its Kind is ignored.

MicrosecondsFromTime(TimeSpan)

Converts a time of day to a time-micros, truncating sub-microsecond ticks.

MicrosecondsFromTimestamp(DateTimeOffset)

Converts an instant to a timestamp-micros, truncating sub-microsecond ticks.

MillisecondsFromLocalTimestamp(DateTime)

Converts a wall-clock time to a local-timestamp-millis; its Kind is ignored.

MillisecondsFromTime(TimeSpan)

Converts a time of day to a time-millis, truncating sub-millisecond ticks.

MillisecondsFromTimestamp(DateTimeOffset)

Converts an instant to a timestamp-millis, truncating sub-millisecond ticks.

ReadDecimalBytes(ref AvroReader, int)

Reads a decimal on bytes: a two's-complement big-endian unscaled integer.

ReadDecimalFixed(ref AvroReader, int, int)

Reads a decimal on fixed: a two's-complement big-endian unscaled integer of the fixed size.

ReadUuidFixed(ref AvroReader)

Reads a uuid on fixed(16): the 16 bytes in RFC 4122 (big-endian) order.

ReadUuidString(ref AvroReader)

Reads a uuid on string (the 36-character hyphenated form).

TimeFromMicroseconds(long)

Converts a time-micros (microseconds after midnight) to a TimeSpan.

TimeFromMilliseconds(int)

Converts a time-millis (milliseconds after midnight) to a TimeSpan.

TimestampFromMicroseconds(long)

Converts a timestamp-micros (microseconds since the Unix epoch, UTC) to a DateTimeOffset.

TimestampFromMilliseconds(long)

Converts a timestamp-millis (milliseconds since the Unix epoch, UTC) to a DateTimeOffset.

WriteDecimalBytes(ref AvroWriter, decimal, int, int)

Writes a decimal on bytes, using the fewest bytes that hold the unscaled value.

WriteDecimalFixed(ref AvroWriter, decimal, int, int, int)

Writes a decimal on fixed, sign-extended to the fixed size.

WriteUuidFixed(ref AvroWriter, Guid)

Writes a uuid on fixed(16), in RFC 4122 (big-endian) byte order.

WriteUuidString(ref AvroWriter, Guid)

Writes a uuid on string, in lowercase hyphenated form.