public class FileModule extends AbstractQuercusModule
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DIRECTORY_SEPARATOR |
static int |
FILE_APPEND |
static int |
FILE_IGNORE_NEW_LINES |
static int |
FILE_SKIP_EMPTY_LINES |
static int |
FILE_USE_INCLUDE_PATH |
static int |
FNM_CASEFOLD |
static int |
FNM_NOESCAPE |
static int |
FNM_PATHNAME |
static int |
FNM_PERIOD |
static int |
GLOB_BRACE |
static int |
GLOB_ERR |
static int |
GLOB_MARK |
static int |
GLOB_NOCHECK |
static int |
GLOB_NOESCAPE |
static int |
GLOB_NOSORT |
static int |
GLOB_ONLYDIR |
static int |
LOCK_EX |
static int |
LOCK_NB |
static int |
LOCK_SH |
static int |
LOCK_UN |
static java.lang.String |
PATH_SEPARATOR |
static int |
PATHINFO_BASENAME |
static int |
PATHINFO_DIRNAME |
static int |
PATHINFO_EXTENSION |
static int |
PATHINFO_FILENAME |
static int |
SEEK_CUR |
static int |
SEEK_END |
static int |
SEEK_SET |
static int |
UPLOAD_ERR_CANT_WRITE |
static int |
UPLOAD_ERR_EXTENSION |
static int |
UPLOAD_ERR_FORM_SIZE |
static int |
UPLOAD_ERR_INI_SIZE |
static int |
UPLOAD_ERR_NO_FILE |
static int |
UPLOAD_ERR_NO_TMP_DIR |
static int |
UPLOAD_ERR_OK |
static int |
UPLOAD_ERR_PARTIAL |
PHP_INI_ALL, PHP_INI_PERDIR, PHP_INI_SYSTEM, PHP_INI_USER
Constructor and Description |
---|
FileModule() |
Modifier and Type | Method and Description |
---|---|
static Value |
basename(StringValue path,
StringValue suffix)
Returns the base name of a string.
|
static boolean |
chdir(Env env,
Path path)
Changes the working directory
|
static boolean |
chgrp(Env env,
Path file,
Value group)
Changes the group of the file.
|
static boolean |
chmod(Env env,
Path file,
int mode)
Changes the permissions of the file.
|
static boolean |
chown(Env env,
Path file,
Value user)
Changes the ownership of the file.
|
static boolean |
chroot(Env env,
Path path)
Changes the working directory, forming a virtual root
|
static void |
clearstatcache(Env env,
boolean clearRealPathCache,
java.lang.String fileName)
Clears the stat cache for the file
|
static Value |
closedir(Env env,
Directory dir)
Closes the directory
|
static boolean |
copy(Env env,
StringValue src,
StringValue dst)
Copies a file to the destination.
|
static Value |
dir(Env env,
StringValue filename)
Opens a directory
|
StringValue |
dirname(Env env,
StringValue path)
Returns the directory name of a string.
|
static Value |
disk_free_space(Env env,
Path directory)
Returns the free space for disk partition containing the directory
|
static Value |
disk_total_space(Env env,
Path directory)
Returns the total space for disk partition containing the directory
|
static Value |
diskfreespace(Env env,
Path directory)
Returns the total space for disk partition containing the directory
|
static boolean |
fclose(Env env,
BinaryStream s)
Closes a file.
|
static boolean |
feof(Env env,
BinaryStream binaryStream)
Checks for the end of file.
|
static boolean |
fflush(Env env,
BinaryOutput os)
Flushes a file.
|
static Value |
fgetc(Env env,
BinaryInput is)
Returns the next character as a byte
|
Value |
fgetcsv(Env env,
BinaryInput is,
int length,
java.lang.String delimiter,
java.lang.String enclosure)
Parses a comma-separated-value line from a file.
|
static Value |
fgets(Env env,
BinaryInput is,
int length)
Returns the next line
|
static Value |
fgetss(Env env,
BinaryInput is,
int length,
Value allowedTags)
Returns the next line stripping tags
|
static boolean |
file_exists(Env env,
StringValue filename)
Returns true if file exists
|
static StringValue |
file_get_contents(Env env,
StringValue filename,
boolean useIncludePath,
Value context,
long offset,
long maxLen)
Parses the file, returning it as a string array.
|
static Value |
file_put_contents(Env env,
StringValue filename,
Value data,
int flags,
Value context)
Writes data to a file.
|
static Value |
file(Env env,
StringValue filename,
int flags,
Value context)
Parses the file, returning it in an array.
|
static Value |
fileatime(Env env,
StringValue filename)
Returns the file access time
|
static Value |
filectime(Env env,
StringValue filename)
Returns the file create time
|
static Value |
filegroup(Env env,
Path path)
Returns the file's group
|
static Value |
fileinode(Env env,
Path path)
Returns the file's inocde
|
static Value |
filemtime(Env env,
StringValue filename)
Returns the file modified time
|
static Value |
fileowner(Env env,
StringValue filename)
Returns the file's owner
|
static Value |
fileperms(Env env,
Path path)
Returns the file's permissions
|
static Value |
filesize(Env env,
StringValue filename)
Returns the file's size
|
static Value |
filetype(Env env,
Path path)
Returns the file's type
|
static boolean |
flock(Env env,
LockableStream fileV,
int operation,
Value wouldBlock)
Advisory locking
|
static boolean |
fnmatch(Env env,
java.lang.String pattern,
java.lang.String string,
int flags)
Returns true if the given string matches the given glob pattern.
|
static BinaryStream |
fopen(Env env,
StringValue filename,
java.lang.String mode,
boolean useIncludePath,
Value contextV)
Opens a file.
|
Value |
fpassthru(Env env,
BinaryInput is)
Output the filepointer data to the output stream.
|
Value |
fputcsv(Env env,
BinaryOutput os,
ArrayValue value,
StringValue delimiter,
StringValue enclosure)
Parses a comma-separated-value line from a file.
|
static Value |
fputs(Env env,
BinaryOutput os,
java.io.InputStream value,
int length)
Writes a string to the file.
|
static Value |
fread(Env env,
BinaryInput is,
int length)
Reads content from a file.
|
static Value |
fscanf(Env env,
BinaryInput is,
StringValue format,
Value[] args)
Reads and parses a line.
|
static Value |
fseek(Env env,
BinaryStream binaryStream,
long offset,
int whence)
Sets the current position.
|
static Value |
fstat(Env env,
BinaryStream stream)
Returns the status of the given file pointer.
|
static Value |
ftell(Env env,
BinaryStream binaryStream)
Returns the current position.
|
static boolean |
ftruncate(Env env,
BinaryOutput handle,
long size)
Truncates a file.
|
static Value |
fwrite(Env env,
BinaryOutput os,
java.io.InputStream value,
int length)
Writes a string to the file.
|
java.util.Map<StringValue,Value> |
getConstMap()
Returns the constants defined by this module.
|
static java.lang.String |
getcwd(Env env)
Returns the current working directory.
|
IniDefinitions |
getIniDefinitions()
Returns the default quercus.ini values.
|
static Value |
glob(Env env,
java.lang.String pattern,
int flags)
Matches all files with the given pattern.
|
static boolean |
is_dir(Env env,
StringValue filename)
Returns true if the path is a directory.
|
static boolean |
is_executable(Env env,
Path path)
Returns true if the path is an executable file
|
static boolean |
is_file(Path path)
Returns true if the path is a file.
|
static boolean |
is_link(Env env,
Path path)
Returns true if the path is a symbolic link
|
static boolean |
is_readable(Path path)
Returns true if the path is readable
|
static boolean |
is_uploaded_file(Env env,
Path path)
Returns true for an uploaded file.
|
static boolean |
is_writable(Env env,
StringValue filename)
Returns true if the path is writable
|
static boolean |
is_writeable(Env env,
StringValue filename)
Returns true if the path is writable
|
boolean |
link(Env env,
Path source,
Path destination)
Creates a hard link
|
static long |
linkinfo(Env env,
Path path) |
static Value |
lstat(Env env,
StringValue filename)
Returns file statistics
|
static boolean |
mkdir(Env env,
StringValue dirname,
int mode,
boolean recursive,
Value context)
Makes the directory
|
static boolean |
move_uploaded_file(Env env,
Path src,
StringValue dst)
Moves the uploaded file.
|
static Value |
opendir(Env env,
StringValue pathName,
Value context)
Opens a directory
|
static BinaryStream |
openForAppend(Env env,
StringValue filename,
boolean isUseIncludePath) |
static Value |
parse_ini_file(Env env,
Path path,
boolean processSections)
Parses the ini file.
|
static Value |
pathinfo(Env env,
java.lang.String path,
Value optionsV)
Parses the path, splitting it into parts.
|
static int |
pclose(Env env,
BinaryStream stream) |
static BinaryStream |
popen(Env env,
java.lang.String command,
StringValue mode) |
static Value |
readdir(Env env,
Directory dir)
Reads the next entry
|
Value |
readfile(Env env,
StringValue filename,
boolean useIncludePath,
Value context)
Read the contents of a file and write them out.
|
static Value |
readlink(Env env,
Path path)
The readlink
|
static Value |
realpath(Env env,
Path path)
Returns the actual path name.
|
static boolean |
rename(Env env,
StringValue from,
StringValue to)
Renames a file
|
static Value |
rewind(Env env,
BinaryStream binaryStream)
Rewinds the stream.
|
static void |
rewinddir(Env env,
Directory dir)
Rewinds the directory listing
|
static boolean |
rmdir(Env env,
StringValue filename,
Value context)
remove a directory
|
static Value |
scandir(Env env,
StringValue fileName,
int order,
Value context)
Scan the directory
|
static int |
set_file_buffer(Env env,
BinaryOutput stream,
int bufferSize)
Sets the write buffer.
|
static Value |
stat(Env env,
StringValue filename)
Returns file statistics
|
boolean |
symlink(Env env,
Path source,
Path destination)
Creates a symlink
|
static java.lang.String |
tempnam(Env env,
Path dir,
java.lang.String prefix)
Creates a temporary file.
|
static FileInputOutput |
tmpfile(Env env)
Creates a temporary file.
|
static boolean |
touch(Env env,
StringValue filename,
int time,
int atime)
sets the time to the current time
|
static int |
umask(Env env,
int maskV)
umask call
|
static boolean |
unlink(Env env,
StringValue filename,
Value context)
remove call
|
addConstant, addConstant, addConstant, getLoadedExtensions
public static final java.lang.String DIRECTORY_SEPARATOR
public static final java.lang.String PATH_SEPARATOR
public static final int UPLOAD_ERR_OK
public static final int UPLOAD_ERR_INI_SIZE
public static final int UPLOAD_ERR_FORM_SIZE
public static final int UPLOAD_ERR_PARTIAL
public static final int UPLOAD_ERR_NO_FILE
public static final int UPLOAD_ERR_NO_TMP_DIR
public static final int UPLOAD_ERR_CANT_WRITE
public static final int UPLOAD_ERR_EXTENSION
public static final int FILE_USE_INCLUDE_PATH
public static final int FILE_IGNORE_NEW_LINES
public static final int FILE_SKIP_EMPTY_LINES
public static final int FILE_APPEND
public static final int LOCK_SH
public static final int LOCK_EX
public static final int LOCK_UN
public static final int LOCK_NB
public static final int FNM_PATHNAME
public static final int FNM_NOESCAPE
public static final int FNM_PERIOD
public static final int FNM_CASEFOLD
public static final int GLOB_MARK
public static final int GLOB_NOSORT
public static final int GLOB_NOCHECK
public static final int GLOB_NOESCAPE
public static final int GLOB_BRACE
public static final int GLOB_ONLYDIR
public static final int GLOB_ERR
public static final int PATHINFO_DIRNAME
public static final int PATHINFO_BASENAME
public static final int PATHINFO_EXTENSION
public static final int PATHINFO_FILENAME
public static final int SEEK_SET
public static final int SEEK_CUR
public static final int SEEK_END
public IniDefinitions getIniDefinitions()
getIniDefinitions
in interface QuercusModule
getIniDefinitions
in class AbstractQuercusModule
public java.util.Map<StringValue,Value> getConstMap()
getConstMap
in interface QuercusModule
getConstMap
in class AbstractQuercusModule
public static Value basename(StringValue path, StringValue suffix)
public static boolean chdir(Env env, Path path)
path
- the path to change topublic static boolean chroot(Env env, Path path)
path
- the path to change topublic static boolean chgrp(Env env, Path file, Value group)
env
- the PHP executing environmentfile
- the file to change the group ofgroup
- the group id to change topublic static boolean chmod(Env env, Path file, int mode)
env
- the PHP executing environmentfile
- the file to change the group ofmode
- the mode id to change topublic static boolean chown(Env env, Path file, Value user)
env
- the PHP executing environmentfile
- the file to change the group ofuser
- the user id to change topublic static void clearstatcache(Env env, boolean clearRealPathCache, java.lang.String fileName)
env
- the PHP executing environmentpublic static boolean copy(Env env, StringValue src, StringValue dst)
src
- the source pathdst
- the destination pathpublic static Value dir(Env env, StringValue filename)
path
- the path to change topublic StringValue dirname(Env env, StringValue path)
public static Value disk_free_space(Env env, Path directory)
directory
- the disk directorypublic static Value disk_total_space(Env env, Path directory)
directory
- the disk directorypublic static Value diskfreespace(Env env, Path directory)
directory
- the disk directorypublic static boolean fclose(Env env, BinaryStream s)
public static boolean feof(Env env, BinaryStream binaryStream)
public static boolean fflush(Env env, BinaryOutput os)
public static Value fgetc(Env env, BinaryInput is)
public Value fgetcsv(Env env, BinaryInput is, int length, java.lang.String delimiter, java.lang.String enclosure)
file
- the file to readlength
- the maximum line lengthdelimiter
- optional comma replacementenclosure
- optional quote replacementpublic static Value fgets(Env env, BinaryInput is, int length)
public static Value fgetss(Env env, BinaryInput is, int length, Value allowedTags)
public static Value file(Env env, StringValue filename, int flags, Value context)
filename
- the file's nameuseIncludePath
- if 1, use the include pathcontext
- the resource contextpublic static Value fileatime(Env env, StringValue filename)
path
- the path to checkpublic static Value filectime(Env env, StringValue filename)
path
- the path to checkpublic static Value filegroup(Env env, Path path)
path
- the path to checkpublic static Value fileinode(Env env, Path path)
path
- the path to checkpublic static Value filemtime(Env env, StringValue filename)
path
- the path to checkpublic static Value fileowner(Env env, StringValue filename)
path
- the path to checkpublic static Value fileperms(Env env, Path path)
path
- the path to checkpublic static Value filesize(Env env, StringValue filename)
path
- the path to checkpublic static Value filetype(Env env, Path path)
path
- the path to checkpublic static boolean file_exists(Env env, StringValue filename)
path
- the path to checkpublic static StringValue file_get_contents(Env env, StringValue filename, boolean useIncludePath, Value context, long offset, long maxLen)
filename
- the file's nameuseIncludePath
- if true, use the include pathcontext
- the resource contextpublic static Value file_put_contents(Env env, StringValue filename, Value data, int flags, Value context)
public static boolean flock(Env env, LockableStream fileV, int operation, Value wouldBlock)
fileV
- the file handleoperation
- the locking operationwouldBlock
- the resource contextpublic static boolean fnmatch(Env env, java.lang.String pattern, java.lang.String string, int flags)
public static BinaryStream fopen(Env env, StringValue filename, java.lang.String mode, boolean useIncludePath, Value contextV)
filename
- the path to the file to openmode
- the mode the file should be opened as.useIncludePath
- if true, search the current include pathpublic static BinaryStream openForAppend(Env env, StringValue filename, boolean isUseIncludePath) throws java.io.IOException
java.io.IOException
public Value fpassthru(Env env, BinaryInput is)
public Value fputcsv(Env env, BinaryOutput os, ArrayValue value, StringValue delimiter, StringValue enclosure)
file
- the file to readdelimiter
- optional comma replacementenclosure
- optional quote replacementpublic static Value fputs(Env env, BinaryOutput os, java.io.InputStream value, int length)
public static Value fread(Env env, BinaryInput is, int length)
is
- the filepublic static Value fscanf(Env env, BinaryInput is, StringValue format, Value[] args)
public static Value fseek(Env env, BinaryStream binaryStream, long offset, int whence)
is
- the stream to testpublic static Value fstat(Env env, BinaryStream stream)
public static Value ftell(Env env, BinaryStream binaryStream)
file
- the stream to testpublic static boolean ftruncate(Env env, BinaryOutput handle, long size)
public static Value fwrite(Env env, BinaryOutput os, java.io.InputStream value, int length)
public static Value glob(Env env, java.lang.String pattern, int flags)
public static java.lang.String getcwd(Env env)
public static boolean is_dir(Env env, StringValue filename)
path
- the path to checkpublic static boolean is_executable(Env env, Path path)
path
- the path to checkpublic static boolean is_file(Path path)
path
- the path to checkpublic static boolean is_link(Env env, Path path)
path
- the path to checkpublic static boolean is_readable(Path path)
path
- the path to checkpublic static boolean is_uploaded_file(Env env, Path path)
path
- the temp name of the uploaded filepublic static boolean is_writable(Env env, StringValue filename)
path
- the path to checkpublic static boolean is_writeable(Env env, StringValue filename)
path
- the path to checkpublic static Value lstat(Env env, StringValue filename)
public static boolean mkdir(Env env, StringValue dirname, int mode, boolean recursive, Value context)
path
- the directory to makepublic static boolean move_uploaded_file(Env env, Path src, StringValue dst)
path
- the temp name of the uploaded filedst
- the destination pathpublic static Value opendir(Env env, StringValue pathName, Value context)
pathName
- the directory to openpublic static Value parse_ini_file(Env env, Path path, boolean processSections)
public static Value pathinfo(Env env, java.lang.String path, Value optionsV)
public static int pclose(Env env, BinaryStream stream)
public static BinaryStream popen(Env env, java.lang.String command, StringValue mode)
public static Value readdir(Env env, Directory dir)
dirV
- the directory resourcepublic Value readfile(Env env, StringValue filename, boolean useIncludePath, Value context)
public static boolean rename(Env env, StringValue from, StringValue to)
fromPath
- the path to change totoPath
- the path to change topublic static Value rewind(Env env, BinaryStream binaryStream)
is
- the file resourcepublic static void rewinddir(Env env, Directory dir)
dirV
- the directory resourcepublic static boolean rmdir(Env env, StringValue filename, Value context)
public static Value closedir(Env env, Directory dir)
dirV
- the directory resourcepublic static Value scandir(Env env, StringValue fileName, int order, Value context)
fileName
- the directorypublic static int set_file_buffer(Env env, BinaryOutput stream, int bufferSize)
public static Value stat(Env env, StringValue filename)
public static java.lang.String tempnam(Env env, Path dir, java.lang.String prefix)
public static FileInputOutput tmpfile(Env env)
public static boolean touch(Env env, StringValue filename, int time, int atime)
public static int umask(Env env, int maskV)
public static boolean unlink(Env env, StringValue filename, Value context)