public class ModelIOHandlerRegistry extends Object implements ModelIOHandler
ModelIOHandler and delegates
read/write operations to them as determined by their supported model types.
Instances of this class are thread-safe as long as all registered handlers are also thread-safe.
| Constructor and Description |
|---|
ModelIOHandlerRegistry() |
| Modifier and Type | Method and Description |
|---|---|
ModelIOHandler |
getHandlerForType(String type)
Get the
ModelIOHandler for the given type or null if no
handler is found. |
List<ModelIOHandler> |
getHandlers()
Get the list of registered
ModelIOHandlers. |
boolean |
handlesType(String type)
Return true if this instance handles 3D model files of the given type.
|
BoundarySource3D |
read(File in,
DoublePrecisionContext precision)
Read a 3D model from the given file, using the file extension as the model type.
|
BoundarySource3D |
read(String type,
File in,
DoublePrecisionContext precision)
Read a 3D model represented as a
BoundarySource3D from the given file. |
BoundarySource3D |
read(String type,
InputStream in,
DoublePrecisionContext precision)
Read a 3D model represented as a
BoundarySource3D from the given input stream. |
void |
setHandlers(List<ModelIOHandler> newHandlers)
Set the list of registered
ModelIOHandlers. |
void |
write(BoundarySource3D model,
File out)
Write the model to the file.
|
void |
write(BoundarySource3D model,
String type,
File out)
Write the model to the file using the specified file type.
|
void |
write(BoundarySource3D model,
String type,
OutputStream out)
Write the model to the given output stream, using the specified model type.
|
public ModelIOHandler getHandlerForType(String type)
ModelIOHandler for the given type or null if no
handler is found.type - model type to retrieve the handler forpublic List<ModelIOHandler> getHandlers()
ModelIOHandlers.ModelIOHandlerspublic void setHandlers(List<ModelIOHandler> newHandlers)
ModelIOHandlers.newHandlers - the new list of ModelIOHandlers.public boolean handlesType(String type)
handlesType in interface ModelIOHandlertype - type 3D model type, indicated by file extensionpublic BoundarySource3D read(File in, DoublePrecisionContext precision)
in - file to read fromprecision - precision context to use in model constructionUncheckedIOException - if an IO operation failsIllegalArgumentException - if the file does not have a file extension or the
file extension does not indicate a supported model typepublic BoundarySource3D read(String type, File in, DoublePrecisionContext precision)
BoundarySource3D from the given file.read in interface ModelIOHandlertype - the model file typein - file to readprecision - precision context to use in model constructionpublic BoundarySource3D read(String type, InputStream in, DoublePrecisionContext precision)
BoundarySource3D from the given input stream.
The input stream is closed before method return.read in interface ModelIOHandlertype - the model input typein - input streamprecision - precision context to use in model constructionpublic void write(BoundarySource3D model, File out)
model - model to writeout - output fileUncheckedIOException - if an IO operation failsIllegalArgumentException - if the file does not have a file extension or the
file extension does not indicate a supported model typepublic void write(BoundarySource3D model, String type, File out)
write in interface ModelIOHandlermodel - model to writetype - the model file typeout - output filepublic void write(BoundarySource3D model, String type, OutputStream out)
write in interface ModelIOHandlermodel - model to writetype - the model file typeout - output streamCopyright © 2016–2020 The Apache Software Foundation. All rights reserved.