←Select platform

FromUri Method

Summary

Wraps a URL as an ILeadStream object.

Syntax
C#
VB
[AsyncStateMachineAttribute(System.Type)] 
public static Task<ILeadStream> FromUri( 
   Uri uri 
) 
<AsyncStateMachineAttribute(System.Type)> 
 Public Shared Function FromUri( 
   ByVal uri As Uri 
) As Task(Of ILeadStream) 

Parameters

uri

.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.

Remarks

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:

C#
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:

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

Refer to RasterCodecs Async Operations for more information and examples.

Requirements

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