FIND YOUR NEXT FEW LINES

Results for “binary”

Small, practical examples. Search by task or narrow things down below.

63 snippets foundClear filters
Arduino / CBinary values & packets

Encode a value as little-endian bytes

Arduino / C: Store the least significant byte first when the protocol requires it.

Arduino / C✓ Tested
C#JSON & binary formats

Enumerate the items of a JSON array

C#: Dispose JsonDocument after reading its elements.

C#✓ Tested
Arduino / CBinary values & packets

Extract the low and high byte of a value

Arduino / C: lowByte and highByte expose the two bytes of a 16-bit value.

Arduino / C✓ Tested
CBinary formats & structured parsing

Format a known timestamp in UTC

C: gmtime converts to UTC calendar fields and strftime formats them.

C✓ Tested
CBinary formats & structured parsing

Format a nonnegative integer amount as whole and fractional units

C: Keep the calculation in integer minor units and use two digits for the remainder.

C✓ Tested
C#JSON & binary formats

Handle malformed JSON

C#: Catch JsonException for malformed JSON without swallowing unrelated failures.

C#✓ Tested
C#JSON & binary formats

Hash a UTF-8 value with SHA-256

C#: Use SHA256.HashData for a one-shot content digest.

C#✓ Tested
JavaFile operations & binary data

Load a small properties configuration

Java: Use a Reader to make the configuration character encoding explicit.

Java✓ Tested
JavaQueues & collection operations

Locate a value in a sorted array

Java: Use Arrays.binarySearch only after establishing ascending order.

Java✓ Tested
C#JSON & binary formats

Measure the byte length of UTF-8 text

C#: Character count and encoded byte count can differ for non-ASCII text.

C#✓ Tested
JavaFile operations & binary data

Move a file to a new name

Java: Files.move changes the path and returns the destination Path.

Java✓ Tested
JavaFile operations & binary data

Normalize relative path components

Java: Path.normalize removes redundant dot components without accessing the filesystem.

Java✓ Tested