Class BlobStreamBuffer
- Namespace
- AsmResolver.DotNet.Builder.Metadata
- Assembly
- AsmResolver.DotNet.dll
Provides a mutable buffer for building up a blob stream in a .NET portable executable.
public class BlobStreamBuffer : IMetadataStreamBuffer
- Inheritance
-
BlobStreamBuffer
- Implements
- Inherited Members
Constructors
BlobStreamBuffer()
Creates a new blob stream buffer with the default blob stream name.
public BlobStreamBuffer()
BlobStreamBuffer(string)
Creates a new blob stream buffer.
public BlobStreamBuffer(string name)
Parameters
namestringThe name of the stream.
Properties
IsEmpty
Gets a value indicating whether the metadata stream buffer does not contain any data.
public bool IsEmpty { get; }
Property Value
Name
Gets the name of the stream.
public string Name { get; }
Property Value
Methods
AppendRawData(byte[])
Appends raw data to the stream.
public uint AppendRawData(byte[] data)
Parameters
databyte[]The data to append.
Returns
- uint
The index to the start of the data.
Remarks
This method does not index the blob data. Calling AppendRawData(byte[]) or GetBlobIndex(byte[]?) on the same data will append the data a second time.
CreateStream()
Serialises the blob stream buffer to a metadata stream.
public BlobStream CreateStream()
Returns
- BlobStream
The metadata stream.
GetBlobIndex(ITypeCodedIndexProvider, BlobSignature?, IErrorListener, object?)
Gets the index to the provided blob signature. If the signature is not present in the buffer, it will be appended to the end of the stream.
public uint GetBlobIndex(ITypeCodedIndexProvider provider, BlobSignature? signature, IErrorListener errorListener, object? diagnosticSource = null)
Parameters
providerITypeCodedIndexProviderThe object to use for obtaining metadata tokens for members in the tables stream.
signatureBlobSignatureThe signature to lookup or add.
errorListenerIErrorListenerThe object responsible for collecting diagnostic information.
diagnosticSourceobjectThe object that is reported back when serialization of the blob fails.
Returns
- uint
The index of the signature.
GetBlobIndex(byte[]?)
Gets the index to the provided blob. If the blob is not present in the buffer, it will be appended to the end of the stream.
public uint GetBlobIndex(byte[]? blob)
Parameters
blobbyte[]The blob to lookup or add.
Returns
- uint
The index of the blob.
ImportStream(BlobStream)
Imports the contents of a user strings stream and indexes all present strings.
public void ImportStream(BlobStream stream)
Parameters
streamBlobStreamThe stream to import.