|
|
|
Re: How to retrieve a specific Resource.Factory from the registry? [message #521790 is a reply to message #521787] |
Thu, 18 March 2010 18:02 |
Ed Merks Messages: 33149 Registered: July 2009 |
Senior Member |
|
|
Cyril,
Given the factory will be determined based on the file extension of the
URI, you'll definitely need to use a URI with the desired file
extension. It's certainly possible to paw through the extension map
part of the registry, but you might end up pulling out a descriptor for
the factory rather than the actual and then you'll need to put in more
effort to resolve it. So specifying a URI that's as close to a
meaningful location as possible is always a good idea. I suppose the
stream you're loading doesn't contain references to other resources, or
at least not relative references, because if it did, the URI of the
resource into which it's loaded is important for turning the relative
references into the correct absolute references.
Cyril Jaquier wrote:
> Hi Ed,
>
> Thank you for the answer. Comments below.
>
>> You could use Resource.Factory.Registry.INSTANCE.createResource, but
>> you'll still need a URI. The created resource won't be in any
>> resource set.
>>
>
> Yes but is URI.createURI(".bla") where ".bla" is a dummy "file" the
> correct way to get the appropriate resource?
>
> In other words, how would you use URI to create a resource that will
> be loaded and saved using Resource#load(stream, options) resp.
> Resource#save(stream, options)?
>
> Thank you.
> Cyril
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.04302 seconds