←Select platform

FromUri Method


Wraps a URL as an ILeadStream object.

public static Task<ILeadStream> FromUri( 
   Uri uri 
 Public Shared Function FromUri( 
   ByVal uri As Uri 
) As Task(Of ILeadStream) 



.NET Uri containing the path to the remote resource. This value will be set into the HttpClientLeadStream.Uri property.

Return Value

ILeadStream object. This method returns an instance of HttpClientLeadStream.


This method will create a new instance of HttpClientLeadStream with Uri set to uri. This object can then be passed to the various LEADTOOLS class members that accept an ILeadStream object. Such as RasterCodecs.GetInformationAsync, RasterCodecs.LoadAsync, RasterCodecs.LoadSvgAsync or RasterCodecs.SaveAsync.

The method will create a new instance of LeadFileStream using:

var httpClientLeadStream = new HttpClientLeadStream(uri); 
await httpClientLeadStream.Open(); 
return httpClientLeadStream; 

Note that for performance reasons, this method will check if uri contains the path to a physical file on disk. In this case, the toolkit will use LeadStream.Factory.OpenFile to create and return a LeadFileStream object instead:

if (IsFileUri(uri)) 
   return LeadStream.Factory.OpenFile(GetPhysicalPath(uri)); 
// Continue as above 

Refer to RasterCodecs Async Operations for more information and examples.


For .NET Framework: A reference to the Leadtools.Async.dll assembly is required to use this functionality.

For .NET Standard: This functionality is included in the Leadtools.dll assembly.

Target Platforms

Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

Leadtools Assembly