You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
First, I'd like to congrat you and thank you for this great library.
In a current project, I need to create a stream with non compressed data at the beginning, and the end but compressed data in the middle (several blocks if possible).
I easily could write non compressed data followed by compressed data and read it. But I can't find any solution to add non compressed data at the end.
Here is one of the many failing ways I tried, could you give me a hint?
`
//First stream
using var streamHeader = WriteMindVersionSection();
//Second stream
using var streamModelInformations = WriteModelInformations(globalModel, modelIndex, instanceIndex, isInterlinkExtraction, out var gridIndicesToSave);
streamModelInformations.Seek(0, SeekOrigin.Begin);
using var compressor = LZ4Stream.Encode(streamHeader);
//Compressing the stream and adding it to streamHeader
streamModelInformations.CopyTo(compressor);
//Then one the many ways I try to add non compressed at the end, Fails like the rest
using var streamPositionSection = new MemoryTributary();
using var bwPosition = new BinaryWriter(streamHeader);
bwPosition.Write((short)14);
bwPosition.Write(21l);
bwPosition.Write(100000l);
return streamHeader;`
I can after read values that were at the beginning of streamHeader and the compressed values in streamModelInformations but if I try to go directly before the short and the two long at the end of the stream, the values I obtain are different than the one I initially wrote.
Thanks for advance if you can help me (and even if you can't ;) )
The text was updated successfully, but these errors were encountered:
The problem was finally resolved, in each method that are building a part stream, I "force" the compressor to be disposed at the end of the method instead of letting the garbage collector do it by its own.
Sorry for the stupid question and thanks once again for your great library
Hi,
First, I'd like to congrat you and thank you for this great library.
In a current project, I need to create a stream with non compressed data at the beginning, and the end but compressed data in the middle (several blocks if possible).
I easily could write non compressed data followed by compressed data and read it. But I can't find any solution to add non compressed data at the end.
Here is one of the many failing ways I tried, could you give me a hint?
`
//First stream
using var streamHeader = WriteMindVersionSection();
//Second stream
using var streamModelInformations = WriteModelInformations(globalModel, modelIndex, instanceIndex, isInterlinkExtraction, out var gridIndicesToSave);
streamModelInformations.Seek(0, SeekOrigin.Begin);
I can after read values that were at the beginning of streamHeader and the compressed values in streamModelInformations but if I try to go directly before the short and the two long at the end of the stream, the values I obtain are different than the one I initially wrote.
Thanks for advance if you can help me (and even if you can't ;) )
The text was updated successfully, but these errors were encountered: