NovelIO


BinaryPickler

Namespace: NovelFS.NovelIO.BinaryPickler

Provides functions for pickling binary data

Nested types and modules

ModuleDescription
BigEndian

Primitive and combinator Pickler/Unpickler pairs that use Big Endian byte order

LittleEndian

Primitive and combinator Pickler/Unpickler pairs that use Little Endian byte order

Functions and values

Function or valueDescription
alt tag ps
Signature: tag:('?7754 -> int32) -> ps:Map<int32,BinaryPU<'?7754>> -> BinaryPU<'?7754>
Type parameters: '?7754

Accepts a tagging function that partitions the type to be pickled/unpickled into two sets, then accepts a PU for each set. This permits creating PUs that might pickle one of several alternatives. The tag is stored in the Endianness of the current platform

array pa
Signature: pa:BinaryPU<'?7758> -> BinaryPU<'?7758 []>
Type parameters: '?7758

A pickler/unpickler pair (PU) for arrays which prefixes the length using the Endianness of the current platform

asciiCharPU
Signature: BinaryPU<char>

A pickler/unpickler pair (PU) for ASCII chars

asciiPU
Signature: BinaryPU<string>

A pickler/unpickler pair (PU) for ASCII strings

boolPU
Signature: BinaryPU<bool>

A pickler/unpickler pair (PU) for bools

byteLengthPrefixed pu
Signature: pu:BinaryPU<'?7760> -> BinaryPU<'?7760>
Type parameters: '?7760

A pickler/unpickler pair (PU) that prefixes the byte length of the structure using the Endianness of the current platform

bytePU
Signature: BinaryPU<byte>

A pickler/unpickler pair (PU) for bytes

decimalPU
Signature: BinaryPU<Decimal>

A pickler/unpickler pair (PU) for decimals in the Endianness of the current platform

encodingPU encoding
Signature: encoding:Encoding -> BinaryPU<string>

Creates a pickler/unpickler pair (PU) for strings using the supplied encoding

float32PU
Signature: BinaryPU<float32>

A pickler/unpickler pair (PU) for float32s in the Endianness of the current platform

floatPU
Signature: BinaryPU<float>

A pickler/unpickler pair (PU) for floats in the Endianness of the current platform

int16PU
Signature: BinaryPU<int16>

A pickler/unpickler pair (PU) for (signed) int16s in the Endianness of the current platform

int64PU
Signature: BinaryPU<int64>

A pickler/unpickler pair (PU) for (signed) int64s in the Endianness of the current platform

intPU
Signature: BinaryPU<int32>

A pickler/unpickler pair (PU) for (signed) ints in the Endianness of the current platform

lengthPrefixed pa
Signature: pa:BinaryPU<char> -> BinaryPU<string>

A pickler/unpickler pair (PU) for creating length prefixed strings from a char PU. The length is prefixed in the Endianness of the current platform

lift x
Signature: x:'?7688 -> BinaryPU<'?7688>
Type parameters: '?7688

Given a value of x, returns a PU of x without affecting the underlying read/write states

list pa
Signature: pa:BinaryPU<'?7756> -> BinaryPU<'?7756 list>
Type parameters: '?7756

A pickler/unpickler pair (PU) for lists which prefixes the length using the Endianness of the current platform

nullTerminated pa
Signature: pa:BinaryPU<char> -> BinaryPU<string>

A pickler/unpickler pair (PU) for creating null terminated strings from a char PU.

optional pa
Signature: pa:BinaryPU<'?7766> -> BinaryPU<'?7766 option>
Type parameters: '?7766

A pickler/unpickler pair (PU) for option types in the Endianness of the current platform

pickle pu value
Signature: pu:BinaryPU<'?7680> -> value:'?7680 -> byte []
Type parameters: '?7680

Uses the supplied pickler/unpickler pair (PU) to pickle the supplied value into a byte array

pickleIncr pu binaryChannel value
Signature: pu:BinaryPU<'?7780> -> binaryChannel:BChannel -> value:'?7780 -> IO<unit>
Type parameters: '?7780

Uses the supplied pickler/unpickler pair (PU) to pickle the supplied data to the supplied binary channel incrementally

repeat pa n
Signature: pa:BinaryPU<'?7708> -> n:int -> BinaryPU<'?7708 list>
Type parameters: '?7708

Repeats a PU n times to create a list PU

repeatA pa n
Signature: pa:BinaryPU<'?7714> -> n:int -> BinaryPU<'?7714 []>
Type parameters: '?7714

Repeats a PU n times to create an array pickler

repeatUntil cond pa
Signature: cond:('?7710 -> bool) -> pa:BinaryPU<'?7710> -> BinaryPU<'?7710 list>
Type parameters: '?7710

Repeats a PU until a condition is met to create a list PU

repeatWhile cond pa
Signature: cond:('?7712 -> bool) -> pa:BinaryPU<'?7712> -> BinaryPU<'?7712 list>
Type parameters: '?7712

Repeats a PU until a condition is met to create a list PU

sequ f pa k
Signature: f:('b -> 'a) -> pa:BinaryPU<'a> -> k:('a -> BinaryPU<'b>) -> BinaryPU<'b>
Type parameters: 'b, 'a

Creates a sequential combination of PU

tuple2 pa pb
Signature: pa:BinaryPU<'?7693> -> pb:BinaryPU<'?7694> -> BinaryPU<'?7693 * '?7694>
Type parameters: '?7693, '?7694

Combines two PU into a PU that pickles a tuple-2

tuple3 pa pb pc
Signature: pa:BinaryPU<'?7696> -> pb:BinaryPU<'?7697> -> pc:BinaryPU<'?7698> -> BinaryPU<'?7696 * '?7697 * '?7698>
Type parameters: '?7696, '?7697, '?7698

Combines three PU into a PU that pickles a tuple-3

tuple4 pa pb pc pd
Signature: pa:BinaryPU<'?7700> -> pb:BinaryPU<'?7701> -> pc:BinaryPU<'?7702> -> pd:BinaryPU<'?7703> -> BinaryPU<'?7700 * '?7701 * '?7702 * '?7703>
Type parameters: '?7700, '?7701, '?7702, '?7703

Combines four PU into a PU that pickles a tuple-4

uint16PU
Signature: BinaryPU<uint16>

A pickler/unpickler pair (PU) for (unsigned) uint16s in the Endianness of the current platform

uint64PU
Signature: BinaryPU<uint64>

A pickler/unpickler pair (PU) for (unsigned) uint64s in the Endianness of the current platform

uintPU
Signature: BinaryPU<uint32>

A pickler/unpickler pair (PU) for (unsigned) uints in the Endianness of the current platform

unitPU
Signature: BinaryPU<unit>

A pickler/unpickler pair (PU) for the unit type

unpickle pu array
Signature: pu:BinaryPU<'a> -> array:byte array -> 'a
Type parameters: 'a

Uses the supplied pickler/unpickler pair (PU) to unpickle the supplied byte array into some type 'a

unpickleIncr pu binaryChannel
Signature: pu:BinaryPU<'?7778> -> binaryChannel:BChannel -> IO<'?7778>
Type parameters: '?7778

Uses the supplied pickler/unpickler pair (PU) to unpickle from the supplied binary channel incrementally

utf16PU
Signature: BinaryPU<string>

A pickler/unpickler pair (PU) for UTF-16 strings which uses a byte order mark to indicate endianness when unpickling. During pickling, little endian is used and a byte order mark to indicate this is prepended.

utf32PU
Signature: BinaryPU<string>

A pickler/unpickler pair (PU) for UTF-32 strings which uses a byte order mark to indicate endianness when unpickling. During pickling, little endian is used and a byte order mark to indicate this is prepended.

utf7PU
Signature: BinaryPU<string>

A pickler/unpickler pair (PU) for UTF-7 strings

utf8BomPU
Signature: BinaryPU<string>

A pickler/unpickler pair (PU) for UTF-8 strings with byte order mark. This pickler is not sensitive to endianness but the byte order mark does serve as an identifier that the subsequent data is in UTF-8.

utf8PU
Signature: BinaryPU<string>

A pickler/unpickler pair (PU) for UTF-8 strings

wrap (fab, fba) pa
Signature: (fab:('?7705 -> '?7706) * fba:('?7706 -> '?7705)) -> pa:BinaryPU<'?7705> -> BinaryPU<'?7706>
Type parameters: '?7705, '?7706

When supplied with a method of transforming between two types reversably and a pickler of the first of those types, returns a PU of the second type.

Fork me on GitHub