com.esri.arcgis.system
Class ObjectCopy

java.lang.Object
  extended by com.esri.arcgis.system.ObjectCopy
All Implemented Interfaces:
com.esri.arcgis.interop.RemoteObjRef, IObjectCopy, Serializable

public class ObjectCopy
extends Object
implements com.esri.arcgis.interop.RemoteObjRef, IObjectCopy

CoClass to copy objects by value.

Description

Provides a mechanism to duplicate an object using an objects persistence mechanism (IPersistStream). The objects state is written to a temporary stream and then "rehydrated" from that stream into a new instance of the object. This process is also known as a 'deep clone' as an object will also duplicate all sub objects that it contains. Even if the object supports IClone, you may still want to use ObjectCopy since it does a full copy or 'deep clone' of the object.

Remarks

ObjectCopy is useful for copying objects such as symbols or elements, particularly in cut-and-paste operations. Be careful, however, when using it on high-level objects such as Map. Objects which have a complicated state may not be fully reinitialized by their IPersistStream implementation, so ObjectCopy may not result in an object that is fully ready to participate with other objects. This is particularly true when using IObjectCopy::Overwrite to replace an object.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

See Also:
Serialized Form

Constructor Summary
ObjectCopy()
          Constructs a ObjectCopy using ArcGIS Engine.
ObjectCopy(Object obj)
          Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
ObjectCopy theObjectCopy = (ObjectCopy) obj;
 
Method Summary
 Object copy(Object pInObject)
          Returns a new object which is a copy of the input object.
 boolean equals(Object o)
          Compare this object with another
static String getClsid()
          getClsid.
 int hashCode()
          the hashcode for this object
 void overwrite(Object pInObject, Object[] pOverwriteObject)
          Overwrites the object with the contents of input object.
 
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

ObjectCopy

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

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

ObjectCopy

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

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

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

copy

public Object copy(Object pInObject)
            throws IOException,
                   AutomationException
Returns a new object which is a copy of the input object.

Description

Used to copy an object by value. The object must support IPersistStream. Even if the object supports IClone you may still want to use Copy as it does a full copy or 'deep clone' of the object.

Remarks

Copy may fail if there is insufficient memory.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
copy in interface IObjectCopy
Parameters:
pInObject - A reference to another Object (IUnknown) (in)
Returns:
A reference to another Object (IUnknown)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

overwrite

public void overwrite(Object pInObject,
                      Object[] pOverwriteObject)
               throws IOException,
                      AutomationException
Overwrites the object with the contents of input object.

Description

Used to overwrite an existing object with the contents of another object. The objects must be the same type of object and support IPersistStream.

Remarks

Overwrite may fail if there is insufficient memory.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
overwrite in interface IObjectCopy
Parameters:
pInObject - A reference to another Object (IUnknown) (in)
pOverwriteObject - A reference to another Object (IUnknown) (in/out: use single element array)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.