How to use a reader

From JReality Wiki
Revision as of 16:38, 10 July 2009 by Steffen (Talk | contribs)

(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Input

de.jreality.util.Input is a utility class that unifies the handling of files, URLs and general InputStreams. The most convenient way to create an Input is the method

Input.getInput(String resourceName)


The resourceName may either be:

For a detailed description, see the javadoc of Input.


Readers

The static method de.jreality.reader.Readers.read(Input input) determines the file format based on the ending of the resource name of the input. For files and URLs it will decide from the file ending which reader to use. This works for instance for ".obj" or ".3ds"-files and for many others.


The code is:

Input input = Input.getInput("demofile.obj");
SceneGraphComponent content = Readers.read(input);