org.netbeans.modules.versioning.core/1 1.5.0 1

org.netbeans.modules.versioning.core.api
Class VCSFileProxy

java.lang.Object
  extended by org.netbeans.modules.versioning.core.api.VCSFileProxy

public final class VCSFileProxy
extends Object

Represents a file on a file system.


Method Summary
 boolean canWrite()
          Determines whether this file is writable or not.
static VCSFileProxy createFileProxy(File file)
          Creates a VCSFileProxy based on io.File.
static VCSFileProxy createFileProxy(FileObject fileObject)
          Creates a VCSFileProxy based on the given FileObject.
static VCSFileProxy createFileProxy(VCSFileProxy parent, String child)
          Creates a new VCSFileProxy from the given parent and child name
 boolean equals(Object obj)
           
 boolean exists()
          Determines whether this file exists or not.
 String getName()
          Returns the name of this file.
 VCSFileProxy getParentFile()
          Returns this files parent or null if this file doesn't have a parent.
 String getPath()
          Determines this files path.
 int hashCode()
           
 boolean isDirectory()
          Determines whether this file is a directory or not.
 boolean isFile()
          Determines whether this file is a normal file or not.
 VCSFileProxy[] listFiles()
          Returns an array of files located in a directory given by this file.
 VCSFileProxy normalizeFile()
          Normalize a file path to a clean form.
 File toFile()
          Returns the corresponding java.io.File in case this instance was created based either on java.io.File or a FileObject based on java.io.File.
 FileObject toFileObject()
          Returns the corresponding FileObject.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

createFileProxy

public static VCSFileProxy createFileProxy(File file)
Creates a VCSFileProxy based on io.File.

Parameters:
file - the file to be represented by VCSFileProxy
Returns:
a VCSFileProxy representing the given file

createFileProxy

public static VCSFileProxy createFileProxy(VCSFileProxy parent,
                                           String child)
Creates a new VCSFileProxy from the given parent and child name

Parameters:
parent - the parent file
child - the child name
Returns:
a VCSFileProxy representing the a file given by the parent and child values

createFileProxy

public static VCSFileProxy createFileProxy(FileObject fileObject)
Creates a VCSFileProxy based on the given FileObject. In case there is a corresponding java.io.File to the FileObject the the io.File will be used as in createFileProxy(java.io.File).

Parameters:
fileObject - the file to be represented by VCSFileProxy
Returns:
a VCSFileProxy representing the given file or null if the given FileObject-s Filesystem isn't supported - e.g. jar filesystem.

getPath

public String getPath()
Determines this files path. Depending on its origin it will be either FileObject.getPath() or File.getAbsoluteFile().

Returns:
this files path
See Also:
File.getPath(), FileObject.getPath()

getName

public String getName()
Returns the name of this file.

Returns:
this files name
See Also:
()

isDirectory

public boolean isDirectory()
Determines whether this file is a directory or not. This method might block for a longer time and shouldn't be called in EDT.

Returns:
true if this file exists and is a directory, otherwise false
See Also:
File.isDirectory()

isFile

public boolean isFile()
Determines whether this file is a normal file or not. This method might block for a longer time and shouldn't be called in EDT.

Returns:
true if this file is a normal file, otherwise false
See Also:
File.isFile()

canWrite

public boolean canWrite()
Determines whether this file is writable or not. This method might block for a longer time and shouldn't be called in EDT.

Returns:
true if this file is writable, otherwise false
See Also:
File.canWrite()

getParentFile

public VCSFileProxy getParentFile()
Returns this files parent or null if this file doesn't have a parent. This method might block for a longer time and shouldn't be called in EDT.

Returns:
this files parent
See Also:
File.getParentFile()

exists

public boolean exists()
Determines whether this file exists or not. This method might block for a longer time and shouldn't be called in EDT.

Returns:
true if this files exists, otherwise false
See Also:
File.exists()

listFiles

public VCSFileProxy[] listFiles()
Returns an array of files located in a directory given by this file. This method might block for a longer time and shouldn't be called in EDT.

Returns:
an array of files located in a directory given by this file or null if this file isn't a directory or an error occurs.
See Also:
File.listFiles()

toFile

public File toFile()
Returns the corresponding java.io.File in case this instance was created based either on java.io.File or a FileObject based on java.io.File. This method might block for a longer time and shouldn't be called in EDT.

Returns:
the corresponding java.io.File instance or null if none is available.
See Also:
createFileProxy(java.io.File), createFileProxy(org.openide.filesystems.FileObject)

toFileObject

public FileObject toFileObject()
Returns the corresponding FileObject. This method might block for a longer time and shouldn't be called in EDT.

Returns:
the corresponding FileObject or null if none available

normalizeFile

public VCSFileProxy normalizeFile()
Normalize a file path to a clean form. This method might block for a longer time and shouldn't be called in EDT.

Returns:
a VCSFileProxy with a normalized file path
See Also:
FileUtil.normalizePath(java.lang.String)

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

org.netbeans.modules.versioning.core/1 1.5.0 1

Built on May 25 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.