public class TLcdEarthAssetModelCodec extends java.lang.Object implements ILcdModelDecoder, ILcdModelEncoder
ILcdEarthAsset
objects.
Metadata objects are encoded to an XML format in which each ILcdEarthAsset
is
represented by a list of key/value pairs. These lists are generated by ILcdEarthAssetCodec
s which can be registered with this class, and are represented in memory as
Properties
objects. The required asset codecs must be registered before this
class can be used.Constructor and Description |
---|
TLcdEarthAssetModelCodec()
Constructs a new
TLcdEarthAssetModelCodec with the default model reference
encoder/decoder, input/output stream factories and asset codecs. |
Modifier and Type | Method and Description |
---|---|
void |
addAssetCodec(ILcdEarthAssetCodec aCodec)
Adds an asset codec to this
TLcdEarthAssetModelCodec . |
boolean |
canDecodeSource(java.lang.String aSourceName)
Checks whether this model decoder can decode the specified data source.
|
boolean |
canExport(ILcdModel aModel,
java.lang.String aDestination)
Returns whether this encoder can export the specified model to the specified destination.
|
boolean |
canSave(ILcdModel aModel)
Returns whether this model encoder can save the specified model to the location it originally came from.
|
ILcdModel |
decode(java.lang.String aSourceName)
Decodes an asset model from the given file.
|
void |
export(ILcdModel aModel,
java.lang.String aDestination)
Exports the specified model to the specified destination.
|
java.util.Collection<ILcdEarthAssetCodec> |
getAssetCodecs()
Returns the current collection of asset codecs.
|
ILcdModelReference |
getDefaultModelReference()
Returns the default model reference.
|
java.lang.String |
getDisplayName()
Returns a short, displayable name for the format that is decoded by this
ILcdModelDecoder . |
ILcdInputStreamFactory |
getInputStreamFactory()
Returns the input stream factory to be used when decoding asset models.
|
ILcdModelReferenceDecoder |
getModelReferenceDecoder()
Returns the model reference decoder.
|
ILcdModelReferenceEncoder |
getModelReferenceEncoder()
Returns the model reference encoder.
|
ILcdOutputStreamFactory |
getOutputStreamFactory()
Returns the output stream factory to be used when encoding asset models.
|
void |
removeAllAssetCodecs()
Removes all asset codecs from this
TLcdEarthAssetModelCodec . |
boolean |
removeAssetCodec(ILcdEarthAssetCodec aCodec)
Removes an asset codec from this
TLcdEarthAssetModelCodec if it is present. |
void |
save(ILcdModel aModel)
Saves the model to the location where it originally came from.
|
void |
setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
Sets the input stream factory to be used when decoding asset models.
|
void |
setModelReferenceDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder)
Sets the model reference decoder
|
void |
setModelReferenceEncoder(ILcdModelReferenceEncoder aModelReferenceEncoder)
Sets the model reference encoder
|
void |
setOutputStreamFactory(ILcdOutputStreamFactory aOutputStreamFactory)
Sets the output stream factory to be used when encoding asset models.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
public TLcdEarthAssetModelCodec()
TLcdEarthAssetModelCodec
with the default model reference
encoder/decoder, input/output stream factories and asset codecs.public java.lang.String getDisplayName()
ILcdModelDecoder
ILcdModelDecoder
.getDisplayName
in interface ILcdModelDecoder
getDisplayName
in interface ILcdModelEncoder
ILcdModelDecoder
.public ILcdModelReference getDefaultModelReference()
public ILcdModelReferenceDecoder getModelReferenceDecoder()
public void setModelReferenceDecoder(ILcdModelReferenceDecoder aModelReferenceDecoder)
aModelReferenceDecoder
- the model reference decoder.public ILcdModelReferenceEncoder getModelReferenceEncoder()
public void setModelReferenceEncoder(ILcdModelReferenceEncoder aModelReferenceEncoder)
aModelReferenceEncoder
- the model reference encoderpublic boolean canDecodeSource(java.lang.String aSourceName)
ILcdModelDecoder
canDecodeSource
in interface ILcdModelDecoder
aSourceName
- the data source to be verified; typically a file name or a URL.true
if this decoder can likely decode the data specified by the source name, false
otherwise.public boolean canSave(ILcdModel aModel)
ILcdModelEncoder
canSave
in interface ILcdModelEncoder
aModel
- the model to be verified.true
if this encoder can save the model in the location where it originally came from,
false
otherwise.ILcdModelEncoder.save(com.luciad.model.ILcdModel)
public void save(ILcdModel aModel) throws java.lang.IllegalArgumentException, java.io.IOException
ILcdModelEncoder
save
in interface ILcdModelEncoder
aModel
- the model to be saved.java.lang.IllegalArgumentException
- if the model cannot be saved by this encoder (!canSave(aModel)
).java.io.IOException
- if an I/O error occurs during encoding.public boolean canExport(ILcdModel aModel, java.lang.String aDestination)
ILcdModelEncoder
canExport
in interface ILcdModelEncoder
aModel
- the model to be verified.aDestination
- the location where the model should be exported to.true
if this encoder can export the specified model to the
specified location, false
otherwise.ILcdModelEncoder.export(com.luciad.model.ILcdModel, java.lang.String)
public ILcdOutputStreamFactory getOutputStreamFactory()
public void setOutputStreamFactory(ILcdOutputStreamFactory aOutputStreamFactory)
TLcdFileOutputStreamFactory
. The
output stream factory must not be null.aOutputStreamFactory
- an output stream factorypublic ILcdInputStreamFactory getInputStreamFactory()
public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
TLcdInputStreamFactory
. The
input stream factory must not be null.aInputStreamFactory
- an input stream factorypublic void export(ILcdModel aModel, java.lang.String aDestination) throws java.lang.IllegalArgumentException, java.io.IOException
ILcdModelEncoder
export
in interface ILcdModelEncoder
aModel
- the model to be exported.aDestination
- the location where the model should be saved. Typically, this is a name for the output
file, but it can also point to a file containing the required properties to create a set
of data files.java.lang.IllegalArgumentException
- if the model cannot be saved by this encoder (!canExport(aModel, aDestinationName)
).java.io.IOException
- if an I/O error occurs during encoding.public ILcdModel decode(java.lang.String aSourceName) throws java.io.IOException
decode
in interface ILcdModelDecoder
aSourceName
- the name of the file to be decodedjava.io.IOException
- if the file cannot be decodedpublic void addAssetCodec(ILcdEarthAssetCodec aCodec)
TLcdEarthAssetModelCodec
. The newly added codec will
have precedence over all previously added codecs.aCodec
- the codec to be registeredpublic boolean removeAssetCodec(ILcdEarthAssetCodec aCodec)
TLcdEarthAssetModelCodec
if it is present.aCodec
- the codec to be removedpublic void removeAllAssetCodecs()
TLcdEarthAssetModelCodec
.public java.util.Collection<ILcdEarthAssetCodec> getAssetCodecs()