Click or drag to resize

MimeTypesHelperGetTrueFileExtension Method

Gets the true file extension for a filename.

Namespace:  VDS.RDF
Assembly:  dotNetRDF (in dotNetRDF.dll) Version:
Syntax
public static string GetTrueFileExtension(
	string filename
)

Parameters

filename
Type: SystemString

Return Value

Type: String

[Missing <returns> documentation for "M:VDS.RDF.MimeTypesHelper.GetTrueFileExtension(System.String)"]

Remarks

This is an alternative to using GetExtension(String) which is designed to take into account known extensions which are used in conjunction with other extensions and mask the true extension, for example. .gz

Consider the filename example.ttl.gz, obtaining the extension the standard way gives only .gz which is unhelpful since it doesn't actually tell us the underlying format of the data only that it is GZipped and if it is GZipped we almost certainly want to stream the data rather than read all into memory and heuristically detect the actual format. Instead we'd like to get .ttl.gz as the file extension which is much more useful and this is what this function does.

Important: This method does not blindly return double extensions whenever they are present (since they may simply by period characters in the filename and not double extensions at all) rather it returns double extensions only when the standard extension is an extension is known to be used with double extensions e.g. .gz that is relevan to the library.

See Also