An abstract representation of file and directory pathnames.
version |
$Id: aa9e601342201eab334a91cdf4e3b20c15913ca8 $ |
---|---|
package |
phing.system.io |
__construct($arg1 = null, $arg2 = null)
getPrefixLength() : int
int
_constructPathname(\unknown_type $pathname)
..
\unknown_type
_constructStringParentStringChild(\unknown_type $parent, \unknown_type $child = null)
..
\unknown_type
\unknown_type
_constructFileParentStringChild(\unknown_type $parent, \unknown_type $child = null)
..
\unknown_type
\unknown_type
getName() : \The
\The
name of the file or directory denoted by this abstract pathname, or the empty string if this pathname's name sequence is empty
getParent() : \The
The parent of an abstract pathname consists of the pathname's prefix, if any, and each name in the pathname's name sequence except for the last. If the name sequence is empty then the pathname does not name a parent directory.
\The
pathname string of the parent directory named by this abstract pathname, or null if this pathname does not name a parent
getParentFile() : \The
The parent of an abstract pathname consists of the pathname's prefix, if any, and each name in the pathname's name sequence except for the last. If the name sequence is empty then the pathname does not name a parent directory.
\The
abstract pathname of the parent directory named by this abstract pathname, or null if this pathname does not name a parent
getPath() : string
string
The string form of this abstract pathname
getPathWithoutBase(string $basedir) : string
uses |
---|
string
Base directory to strip
string
Path without basedir
isAbsolute() : boolean
boolean
true if this abstract pathname is absolute, false otherwise
getAbsolutePath() : string
If this abstract pathname is already absolute, then the pathname string is simply returned as if by the getPath method. If this abstract pathname is the empty abstract pathname then the pathname string of the current user directory, which is named by the system property user.dir, is returned. Otherwise this pathname is resolved in a system-dependent way. On UNIX systems, a relative pathname is made absolute by resolving it against the current user directory. On Win32 systems, a relative pathname is made absolute by resolving it against the current directory of the drive named by the pathname, if any; if not, it is resolved against the current user directory.
see | \#isAbsolute() |
---|
string
The absolute pathname string denoting the same file or directory as this abstract pathname
getAbsoluteFile() : string
string
The absolute abstract pathname denoting the same file or directory as this abstract pathname
getCanonicalPath() : string
A canonical pathname is both absolute and unique. The precise definition of canonical form is system-dependent. This method first converts this pathname to absolute form if necessary, as if by invoking the getAbsolutePath() method, and then maps it to its unique form in a system-dependent way. This typically involves removing redundant names such as "." and .. from the pathname, resolving symbolic links (on UNIX platforms), and converting drive letters to a standard case (on Win32 platforms).
Every pathname that denotes an existing file or directory has a unique canonical form. Every pathname that denotes a nonexistent file or directory also has a unique canonical form. The canonical form of the pathname of a nonexistent file or directory may be different from the canonical form of the same pathname after the file or directory is created. Similarly, the canonical form of the pathname of an existing file or directory may be different from the canonical form of the same pathname after the file or directory is deleted.
string
The canonical pathname string denoting the same file or directory as this abstract pathname
getCanonicalFile() : \PhingFile
\PhingFile
The canonical pathname string denoting the same file or directory as this abstract pathname
toURL() : void
Usage note: This method does not automatically escape characters that are illegal in URLs. It is recommended that new code convert an abstract pathname into a URL by first converting it into a URI, via the toURI() method, and then converting the URI into a URL via the URI::toURL()
todo |
Not implemented yet |
---|
toURI() : void
todo |
Not implemented yet |
---|
_slashify(\PhingFile|string $path, boolean $isDirectory) : string
canRead() : boolean
boolean
true if and only if the file specified by this abstract pathname exists and can be read by the application; false otherwise
canWrite() : boolean
boolean
true if and only if the file system actually contains a file denoted by this abstract pathname and the application is allowed to write to the file; false otherwise.
exists() : boolean
boolean
true if and only if the file denoted by this abstract pathname exists; false otherwise
isDirectory() : boolean
boolean
true if and only if the file denoted by this abstract pathname exists and is a directory; false otherwise
isFile() : boolean
boolean
true if and only if the file denoted by this abstract pathname exists and is a normal file; false otherwise
isHidden() : boolean
boolean
true if and only if the file denoted by this abstract pathname is hidden according to the conventions of the underlying platform
isLink() : boolean
boolean
true if and only if the file denoted by this abstract pathname exists and is a symbolic link; false otherwise
getLinkTarget() : string
string
the target of the symbolic link denoted by this abstract pathname
lastModified() : int
int
An integer value representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0 if the file does not exist or if an I/O error occurs
length() : int
The return value is unspecified if this pathname denotes a directory.
int
The length, in bytes, of the file denoted by this abstract pathname, or 0 if the file does not exist
contents() : string
This method uses file_get_contents() to read file in an optimized way.
throws |
|
---|
string
createNewFile($parents = true, $mode = 511) : boolean
throws |
if file can't be created |
---|---|
boolean
true if the named file does not exist and was
successfully created; false
if the named file
already exists
delete($recursive = false) : boolean
boolean
true if and only if the file or directory is successfully deleted; false otherwise
deleteOnExit()
Once deletion has been requested, it is not possible to cancel the request. This method should therefore be used with care.
listDir(mixed $filter = null) : array
If this abstract pathname does not denote a directory, then this method returns null Otherwise an array of strings is returned, one for each file or directory in the directory. Names denoting the directory itself and the directory's parent directory are not included in the result. Each string is a file name rather than a complete path.
There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.
mixed
string
array
An array of strings naming the files and directories in the directory denoted by this abstract pathname. The array will be empty if the directory is empty. Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.
listFiles(\PhingFile[] $filter = null)
..
\PhingFile[]
mkdirs($mode = 493) : boolean
throws | |
---|---|
boolean
true if and only if the directory was created, along with all necessary parent directories; false otherwise
mkdir($mode = 493) : boolean
throws | |
---|---|
boolean
true if and only if the directory was created; false otherwise
renameTo(\PhingFile $destFile) : boolean
boolean
true if and only if the renaming succeeded; false otherwise
copyTo(\PhingFile $destFile) : boolean
boolean
true if and only if the renaming succeeded; false otherwise
setLastModified(int $time) : boolean
All platforms support file-modification times to the nearest second, but some provide more precision. The argument will be truncated to fit the supported precision. If the operation succeeds and no intervening operations on the file take place, then the next invocation of the lastModified method will return the (possibly truncated) time argument that was passed to this method.
int
The new last-modified time, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970)
boolean
true if and only if the operation succeeded; false otherwise
setReadOnly() : boolean
boolean
true if and only if the operation succeeded; false otherwise
setUser(mixed $user)
mixed
User name or number.
getUser() : int
int
User ID of the owner of this file.
setGroup($group)
getGroup() : int
int
User ID of the owner of this file.
setMode(int $mode)
int
Ocatal mode.
getMode() : int
int
listRoots() : array
A particular platform may support zero or more hierarchically-organized file systems. Each file system has a root directory from which all other files in that file system can be reached. Windows platforms, for example, have a root directory for each active drive; UNIX platforms have a single root directory, namely "/". The set of available filesystem roots is affected by various system-level operations such the insertion or ejection of removable media and the disconnecting or unmounting of physical or virtual disk drives.
This method returns an array of PhingFile objects that denote the root directories of the available filesystem roots. It is guaranteed that the canonical pathname of any file physically present on the local machine will begin with one of the roots returned by this method.
The canonical pathname of a file that resides on some other machine and is accessed via a remote-filesystem protocol such as SMB or NFS may or may not begin with one of the roots returned by this method. If the pathname of a remote file is syntactically indistinguishable from the pathname of a local file then it will begin with one of the roots returned by this method. Thus, for example, PhingFile objects denoting the root directories of the mapped network drives of a Windows platform will be returned by this method, while PhingFile objects containing UNC pathnames will not be returned by this method.
array
An array of PhingFile objects denoting the available filesystem roots, or null if the set of roots could not be determined. The array will be empty if there are no filesystem roots.
getTempDir() : string
string
createTempFile($prefix, $suffix, \PhingFile $directory) : \PhingFile
Then, the file is locked for exclusive reading/writing.
author |
manuel holtgrewe, grin@gmx.net |
---|---|
throws | |
\PhingFile
removeTempFile()
access |
public |
---|
compareTo(\PhingFile $file) : int
int
Zero if the argument is equal to this abstract pathname, a value less than zero if this abstract pathname is lexicographically less than the argument, or a value greater than zero if this abstract pathname is lexicographically greater than the argument
equals($obj) : boolean
Returns true
if and only if the argument is not
null
and is an abstract pathname that denotes the same file
or directory as this abstract pathname. Whether or not two abstract
pathnames are equal depends upon the underlying system. On UNIX
systems, alphabetic case is significant in comparing pathnames; on Win32
systems it is not.
boolean
toString() : string
string
__toString() : string
string
separator :
pathSeparator :
path :
prefixLength : int
var |
---|
int