public bool TryDequeue(out ChunkDecompressionInfo info) { if (position >= length.Value) { info = default; return(false); } reader.Read(infoBuffer, 0, ChunkCompressedInfo.SIZE, position); position += ChunkCompressedInfo.SIZE; var compressedInfo = ChunkCompressedInfo.FromBinary(infoBuffer, 0); info = new ChunkDecompressionInfo( new ChunkInfo(position, compressedInfo.size), compressedInfo.target); position += compressedInfo.size; return(true); }
public void ShouldSerializeDeserialize(int size1, long offset2, int size2) { // Arrange var buffer = new byte[ChunkCompressedInfo.SIZE]; var input = new ChunkCompressedInfo(size1, new ChunkInfo(offset2, size2)); // Act ChunkCompressedInfo.ToBinary(input, buffer, 0); var result = ChunkCompressedInfo.FromBinary(buffer, 0); // Assert Assert.Equal(size1, result.size); Assert.Equal(offset2, result.target.offset); Assert.Equal(size2, result.target.size); }