com.esri.arcgis.carto
Class LayerFile

java.lang.Object
  extended by com.esri.arcgis.carto.LayerFile
All Implemented Interfaces:
ILayerFile, com.esri.arcgis.interop.RemoteObjRef, IDocumentVersion, Serializable

public class LayerFile
extends Object
implements com.esri.arcgis.interop.RemoteObjRef, ILayerFile, IDocumentVersion

The LayerFile coclass is used to read and write layer document files.

Description

When creating a new LayerFile object the ReplaceContents method must be used to set your Layer, as the Layer property is Read-Only. If a new LayerFile is created but no Layer has been set, the IsLayerFile will return False.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

See Also:
Serialized Form

Constructor Summary
LayerFile()
          Constructs a LayerFile using ArcGIS Engine.
LayerFile(Object obj)
          Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
LayerFile theLayerFile = (LayerFile) obj;
 
Method Summary
 void close()
          Close the layer file.
 boolean equals(Object o)
          Compare this object with another
 void esri_new(String sFile)
          Creates and opens a new layer File in preparation for the contents to be retrieve or updated.
static String getClsid()
          getClsid.
 int getDocumentVersion()
          The version of the document to save.
 String getFilename()
          The name of the layer file that the LayerFile coclass is linked to.
 ILayer getLayer()
          The Layer object.
 IPicture getThumbnail()
          The thumbnail stored in the layer file.
 int hashCode()
          the hashcode for this object
 boolean isLayerFile(String sFile)
          Indicates if the file is a valid layer file.
 boolean isPresent(String sFile)
          Indicates if the layer file is present.
 boolean isReadOnly(String sFile)
          Indicates if the layer file is read only.
 void open(String sFile)
          Open the layer file in preparation for the contents to be retrieved or updated.
 void replaceContents(ILayer pLayer)
          Replace the contents of the layer file.
 void save()
          Save the contents of the layer file to the bound file.
 void saveAs(String sFile)
          Save the contents of the layer file to the specified file name.
 void setDocumentVersion(int docVersion)
          The version of the document to save.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.esri.arcgis.interop.RemoteObjRef
getJintegraDispatch, release
 

Constructor Detail

LayerFile

public LayerFile()
          throws IOException,
                 UnknownHostException
Constructs a LayerFile using ArcGIS Engine.

Throws:
IOException - if there are interop problems
UnknownHostException - if there are interop problems

LayerFile

public LayerFile(Object obj)
          throws IOException
Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
LayerFile theLayerFile = (LayerFile) obj;

Construct a LayerFile using a reference to such an object returned from ArcGIS Engine or Server. This is semantically equivalent to casting obj to LayerFile.

Parameters:
obj - an object returned from ArcGIS Engine or Server
Throws:
IOException - if there are interop problems
Method Detail

getClsid

public static String getClsid()
getClsid.


equals

public boolean equals(Object o)
Compare this object with another

Overrides:
equals in class Object

hashCode

public int hashCode()
the hashcode for this object

Overrides:
hashCode in class Object

getFilename

public String getFilename()
                   throws IOException,
                          AutomationException
The name of the layer file that the LayerFile coclass is linked to.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getFilename in interface ILayerFile
Returns:
The sFile
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isLayerFile

public boolean isLayerFile(String sFile)
                    throws IOException,
                           AutomationException
Indicates if the file is a valid layer file.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
isLayerFile in interface ILayerFile
Parameters:
sFile - The sFile (in)
Returns:
The isLayerFile
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isPresent

public boolean isPresent(String sFile)
                  throws IOException,
                         AutomationException
Indicates if the layer file is present.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
isPresent in interface ILayerFile
Parameters:
sFile - The sFile (in)
Returns:
The isPresent
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isReadOnly

public boolean isReadOnly(String sFile)
                   throws IOException,
                          AutomationException
Indicates if the layer file is read only.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
isReadOnly in interface ILayerFile
Parameters:
sFile - The sFile (in)
Returns:
The isReadOnly
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getLayer

public ILayer getLayer()
                throws IOException,
                       AutomationException
The Layer object. If no layer object is stored in the layer file this returns NULL.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getLayer in interface ILayerFile
Returns:
A reference to a com.esri.arcgis.carto.ILayer
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getThumbnail

public IPicture getThumbnail()
                      throws IOException,
                             AutomationException
The thumbnail stored in the layer file. If this is empty E_FAIL is returned.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getThumbnail in interface ILayerFile
Returns:
A reference to a com.esri.arcgis.support.ms.stdole.IPicture
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

esri_new

public void esri_new(String sFile)
              throws IOException,
                     AutomationException
Creates and opens a new layer File in preparation for the contents to be retrieve or updated.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
esri_new in interface ILayerFile
Parameters:
sFile - The sFile (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

open

public void open(String sFile)
          throws IOException,
                 AutomationException
Open the layer file in preparation for the contents to be retrieved or updated.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
open in interface ILayerFile
Parameters:
sFile - The sFile (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

close

public void close()
           throws IOException,
                  AutomationException
Close the layer file.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
close in interface ILayerFile
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

replaceContents

public void replaceContents(ILayer pLayer)
                     throws IOException,
                            AutomationException
Replace the contents of the layer file.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
replaceContents in interface ILayerFile
Parameters:
pLayer - A reference to a com.esri.arcgis.carto.ILayer (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

save

public void save()
          throws IOException,
                 AutomationException
Save the contents of the layer file to the bound file.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
save in interface ILayerFile
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

saveAs

public void saveAs(String sFile)
            throws IOException,
                   AutomationException
Save the contents of the layer file to the specified file name.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
saveAs in interface ILayerFile
Parameters:
sFile - The sFile (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setDocumentVersion

public void setDocumentVersion(int docVersion)
                        throws IOException,
                               AutomationException
The version of the document to save.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
setDocumentVersion in interface IDocumentVersion
Parameters:
docVersion - A com.esri.arcgis.system.esriArcGISVersion constant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getDocumentVersion

public int getDocumentVersion()
                       throws IOException,
                              AutomationException
The version of the document to save.

Remarks

Determines which version an object is persisted. This can be useful when saving an object ObjectStream or MemoryBlobStream and you want the version of that object to be compatible with previous releases of ArcGIS. Not all persistable objects implement IDocumentVersion; you should ensure the object supports this interface before accessing this property.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getDocumentVersion in interface IDocumentVersion
Returns:
A com.esri.arcgis.system.esriArcGISVersion constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.