com.esri.arcgis.system
Class FileNames

java.lang.Object
  extended by com.esri.arcgis.system.FileNames
All Implemented Interfaces:
com.esri.arcgis.interop.RemoteObjRef, IFileNames, IFileNames2, Serializable

public class FileNames
extends Object
implements com.esri.arcgis.interop.RemoteObjRef, IFileNames, IFileNames2

FileNames object maintains an array of file paths.

Remarks

The FileNames object is used by several interfaces including IWorkspaceFactory and IGxObjectFactory to determine whether a set of files conform to a particular data source.

FileNames offers some advanced file-specific array methods through its IFileNames2 interface.

The FileNames object is not associated with the FileName object which performs a specific role as a Name object.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

See Also:
Serialized Form

Constructor Summary
FileNames()
          Constructs a FileNames using ArcGIS Engine.
FileNames(Object obj)
          Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
FileNames theFileNames = (FileNames) obj;
 
Method Summary
 void add(String fileName)
          Adds a filename to the array.
 boolean equals(Object o)
          Compare this object with another
 boolean find(String fileName)
          Advances the current postion to the specified file if it exists.
static String getClsid()
          getClsid.
 String getContainedExtensions()
          Obtains a delimited set of extensions contained within the collection.
 IFileNames getSubset(String extSet)
          Obtains a subset based on a delimited set of extensions.
 int hashCode()
          the hashcode for this object
 boolean isDirectory()
          Indicates if the current filename is a directory.
 void loadFromPath(String path)
          Loads the collection with files from the specified path.
 String next()
          Obtains the next filename in the array.
 void remove()
          Removes the current filename from the array.
 void reset()
          Resets the current position back to the beginning of the array.
 
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

FileNames

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

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

FileNames

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

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

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

add

public void add(String fileName)
         throws IOException,
                AutomationException
Adds a filename to the array.

Description

The Add method adds the specified file name to the end of the array as a full path string. The path can refer to a directory or a file. Use the IsDirectory method to determine with the path specifies a directory or file.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

remove

public void remove()
            throws IOException,
                   AutomationException
Removes the current filename from the array.

Description

Removes the current file name in the array from the array.

Remarks

The Remove method cannot be called right after the Reset method. First point to an element in array by calling the Next method, and the Remove method can be used after that.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

reset

public void reset()
           throws IOException,
                  AutomationException
Resets the current position back to the beginning of the array.

Description

The Reset method resets the array so that the next call to the Next method returns the first file name in the array.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

next

public String next()
            throws IOException,
                   AutomationException
Obtains the next filename in the array.

Description

Returns the current file name in the array as a full path string.

The Next method will return a zero-length string when it reaches the end of the array. Use the Reset method to go back to the beginning of the array to gain sequential access to the file names.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
next in interface IFileNames
Returns:
The fileName
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isDirectory

public boolean isDirectory()
                    throws IOException,
                           AutomationException
Indicates if the current filename is a directory.

Description

Indicates whether the current file name in the array is a directory or a file.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

loadFromPath

public void loadFromPath(String path)
                  throws IOException,
                         AutomationException
Loads the collection with files from the specified path.

Description

The LoadFromPath method adds any file names to the array (both directories and files) that are found in the specified directory path.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

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

getSubset

public IFileNames getSubset(String extSet)
                     throws IOException,
                            AutomationException
Obtains a subset based on a delimited set of extensions.

Description

The GetSubset method returns a FileNames object consisting of a subset of the file names in the array that have the specified extension.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
getSubset in interface IFileNames2
Parameters:
extSet - The extSet (in)
Returns:
A reference to a com.esri.arcgis.system.IFileNames
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getContainedExtensions

public String getContainedExtensions()
                              throws IOException,
                                     AutomationException
Obtains a delimited set of extensions contained within the collection.

Description

The GetContainedExtensions method returns a delimited string containing the file name extensions within the array. For example, "txt|shp".

If the array contains a file name which is a directory, "<dir>" is returned. For example, "txt|<dir>|shp". Use the IFileNames::IsDirectory method to determine if a file name is a directory or a file.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
getContainedExtensions in interface IFileNames2
Returns:
The extSet
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

find

public boolean find(String fileName)
             throws IOException,
                    AutomationException
Advances the current postion to the specified file if it exists.

Description

Indicates whether the specified file name exists in the array.

Remarks

If the array contains a file name which is a directory path, the Find method returns False (not found) if the directory path was passed to be searched. The Find method searches only for files.

Product Availability

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

Supported Platforms

Windows, Solaris, Linux

Specified by:
find in interface IFileNames2
Parameters:
fileName - The fileName (in)
Returns:
The pFound
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.