Click or drag to resize

CompactMeasurementExtensionsCompressPayload Method

Attempts to compress payload of CompactMeasurement values onto the destination stream.

Namespace: GSF.TimeSeries.Transport
Assembly: GSF.TimeSeries (in GSF.TimeSeries.dll) Version: 2.4.207-beta
Syntax
public static bool CompressPayload(
	this IEnumerable<CompactMeasurement> compactMeasurements,
	BlockAllocatedMemoryStream destination,
	byte compressionStrength,
	bool includeTime,
	ref DataPacketFlags flags
)
View Source

Parameters

compactMeasurements  IEnumerableCompactMeasurement
Payload of CompactMeasurement values.
destination  BlockAllocatedMemoryStream
Memory based destination stream to hold compressed payload.
compressionStrength  Byte
Compression strength to use.
includeTime  Boolean
Flag that determines if time should be included in the compressed payload.
flags  DataPacketFlags
Current DataPacketFlags.

Return Value

Boolean
true if payload was compressed and encoded onto destination stream; otherwise false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerableCompactMeasurement. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks

Compressed payload will only be encoded onto destination stream if compressed size would be smaller than normal serialized size.

As an optimization this function uses a compression method that uses pointers to native structures, as such the endian order encoding of the compressed data will always be in the native-endian order of the operating system. This will be an important consideration when writing a endian order neutral payload decompressor. To help with this the actual endian order used during compression is marked in the data flags. However, measurements values are consistently encoded in big-endian order prior to buffer compression.

See Also