/// <summary>Reads the custom code table, if there is one</summary> void ReadCodeTable() { // The length given includes the nearSize and sameSize bytes int compressedTableLength = IOHelper.ReadBigEndian7BitEncodedInt(delta) - 2; int nearSize = IOHelper.CheckedReadByte(delta); int sameSize = IOHelper.CheckedReadByte(delta); byte[] compressedTableData = IOHelper.CheckedReadBytes(delta, compressedTableLength); byte[] defaultTableData = CodeTable.Default.GetBytes(); MemoryStream tableOriginal = new MemoryStream(defaultTableData, false); MemoryStream tableDelta = new MemoryStream(compressedTableData, false); byte[] decompressedTableData = new byte[1536]; MemoryStream tableOutput = new MemoryStream(decompressedTableData, true); Decode(tableOriginal, tableDelta, tableOutput, 0); if (tableOutput.Position != 1536) { throw new VcdiffFormatException("Compressed code table was incorrect size"); } codeTable = new CodeTable(decompressedTableData); cache = new AddressCache(nearSize, sameSize); }
private void ReadCodeTable() { int size = IOHelper.ReadBigEndian7BitEncodedInt(delta) - 2; int nearSize = IOHelper.CheckedReadByte(delta); int sameSize = IOHelper.CheckedReadByte(delta); byte[] buffer = IOHelper.CheckedReadBytes(delta, size); byte[] bytes = CodeTable.Default.GetBytes(); MemoryStream memoryStream = new MemoryStream(bytes, writable: false); MemoryStream memoryStream2 = new MemoryStream(buffer, writable: false); byte[] array = new byte[1536]; MemoryStream memoryStream3 = new MemoryStream(array, writable: true); Decode(memoryStream, memoryStream2, memoryStream3, 0L); if (memoryStream3.Position != 1536) { throw new VcdiffFormatException("Compressed code table was incorrect size"); } codeTable = new CodeTable(array); cache = new AddressCache(nearSize, sameSize); }
/// <summary>Reads the custom code table, if there is one</summary> void ReadCodeTable() { // The length given includes the nearSize and sameSize bytes int compressedTableLength = IOHelper.ReadBigEndian7BitEncodedInt(delta)-2; int nearSize = IOHelper.CheckedReadByte(delta); int sameSize = IOHelper.CheckedReadByte(delta); byte[] compressedTableData = IOHelper.CheckedReadBytes(delta, compressedTableLength); byte[] defaultTableData = CodeTable.Default.GetBytes(); MemoryStream tableOriginal = new MemoryStream(defaultTableData, false); MemoryStream tableDelta = new MemoryStream(compressedTableData, false); byte[] decompressedTableData = new byte[1536]; MemoryStream tableOutput = new MemoryStream(decompressedTableData, true); Decode(tableOriginal, tableDelta, tableOutput, 0); if (tableOutput.Position != 1536) { throw new VcdiffFormatException("Compressed code table was incorrect size"); } codeTable = new CodeTable(decompressedTableData); cache = new AddressCache(nearSize, sameSize); }