public abstract class FileAdapter extends File
ClosedFolderIcon, DOS_SYSTEM, DriveIcon, FileIcon, FLAG_CASE_SENSITIVE, FLAG_FILE_SYSTEM_IS_READ_ONLY, FLAG_READ_ONLY, FLAG_SLOW_ACCESS, FLAG_SLOW_CHILD_COUNT, FLAG_SLOW_LIST, INFO_CREATE_TEMP, INFO_CURRENT_DIRECTORY, INFO_DETAIL_NAMES, INFO_DETAIL_WIDTHS, INFO_DETAILS, INFO_DEVICE_ICON, INFO_DEVICE_NAME, INFO_FILE_TIMES, INFO_FLAGS, INFO_FREE_DRIVE_SPACE, INFO_GROUP, INFO_ICON, INFO_LINK_DESTINATION, INFO_OPTION_ICON_LARGE, INFO_OPTION_ICON_MEDIUM, INFO_OPTION_ICON_SMALL, INFO_OWNER, INFO_PROGRAM_DIRECTORY, INFO_ROOT_LIST, INFO_SET_USER_AND_GROUP, INFO_SYMBOLIC_LINK_TARGET, INFO_SYSTEM_TYPE, INFO_TEMPORARY_DIRECTORY, INFO_TOOL_TIP, INFO_TOTAL_DRIVE_SPACE, INFO_VOLUME_FLAGS, INFO_VOLUME_LIST, INFO_VOLUME_PROPERTIES, LIST_ALWAYS_INCLUDE_DIRECTORIES, LIST_BY_DATE, LIST_BY_NAME, LIST_BY_SIZE, LIST_BY_TYPE, LIST_CHECK_FOR_ANY_MATCHING_CHILDREN, LIST_DESCENDING, LIST_DIRECTORIES_FIRST, LIST_DIRECTORIES_LAST, LIST_DIRECTORIES_ONLY, LIST_DONT_LIST_HIDDEN_FILES, LIST_DONT_SORT, LIST_FILES_ONLY, LIST_IGNORE_DIRECTORY_STATUS, MEMORY_SYSTEM, OpenFolderIcon, PageIcon, PALM_SYSTEM, pathSeparator, pathSeparatorChar, separator, separatorChar, UNIX_SYSTEM
VOLUME_FLAG_CDROM, VOLUME_FLAG_FIXED, VOLUME_FLAG_NETWORK, VOLUME_FLAG_RAM, VOLUME_FLAG_REMOVABLE, VOLUME_PROPERTY_BYTES_FREE, VOLUME_PROPERTY_BYTES_TOTAL, VOLUME_PROPERTY_FILESYSTEM_NAME, VOLUME_PROPERTY_NAME
ALL_DOS_FLAGS, ALL_UNIX_PERMISSIONS, FLAG_ARCHIVE, FLAG_HIDDEN, FLAG_READONLY, FLAG_ROM, FLAG_ROMMODULE, FLAG_SYSTEM, FLAG_WINDOWS_ALL_USERS_ACCESS, GROUP_EXECUTE, GROUP_READ, GROUP_WRITE, OTHER_EXECUTE, OTHER_READ, OTHER_WRITE, OWNER_EXECUTE, OWNER_READ, OWNER_WRITE
Modifier | Constructor and Description |
---|---|
protected |
FileAdapter() |
protected |
FileAdapter(File directory,
String name) |
protected |
FileAdapter(String name) |
Modifier and Type | Method and Description |
---|---|
boolean |
canRead()
Returns true if the file exists and can be read.
|
boolean |
canWrite() |
abstract boolean |
createDir()
Creates a directory.
|
boolean |
createSymbolicLink(String target)
Create a symbolic link to a specified target file.
|
abstract boolean |
delete()
Deletes the file or directory.
|
abstract void |
deleteOnExit()
This tells the system to delete the file when the program exits.
|
abstract boolean |
exists()
Returns true if the file exists and false otherwise.
|
abstract String |
getFullPath()
Return the fully qualified pathname of the file.
|
Wrapper |
getInfo(int infoCode,
Wrapper sourceParameters,
int options)
This method is used to get extended information about the File or the File system in general.
|
abstract long |
getLength() |
protected File |
getNewInstance()
Get a new instance of this File().
|
protected abstract long |
getSetModified(long time,
boolean doGet)
This gets/sets the modified time of the file.
|
protected int |
getSetPermissionsAndFlags(boolean isGet,
int valuesToSetOrGet,
int valuesToClear)
This is used to implement getPermissionsAndFlags() and changePermissionsAndFlags().
|
int |
getSupportedPermissionsAndFlags(int interestedFlags)
Returns a value indicating which of the flags
specified in the interestedFlags parameter is supported by the
underlying system.
|
File |
getSymbolicLinkTarget()
If this file is a symbolic link, return the target of the link.
|
abstract boolean |
isDirectory()
Returns true if the file is a directory and false otherwise.
|
boolean |
isSymbolicLink()
Returns true if the file is a symbolic link.
|
abstract String[] |
list(String mask,
int listAndSortOptions)
Lists the files contained in a directory.
|
CharArray |
list(String mask,
int listAndSortOptions,
CharArray dest)
List the files contained in a directory, as a list of names separated by '|' characters
which are appended to the destination CharArray.
|
abstract boolean |
move(File newFile)
This moves/renames the file to the destination new File.
|
void |
set(File parent,
String name)
Modifies the File to point to a different file on the file system.
|
protected void |
setFullPathName(File parent,
String file) |
boolean |
setInfo(int infoCode,
Wrapper sourceParameters,
int options) |
File |
toJavaFile()
This returns null by default - since a FileAdapter does not represent an OS File.
|
RandomStream |
toRandomStream(String mode)
Create and return a RandomAccessStream for reading/writing to the data associated with this File object.
|
allowAllUsersFullAccess, changePermissionsAndFlags, chmod, chown, createNewFile, createTempFile, createTempFile, equals, filePathsAreEqual, fixupPath, getAbsoluteFile, getAbsolutePath, getBestFileChooser, getCanonicalFile, getCanonicalPath, getChild, getChild, getCopy, getCreationName, getCreationName, getDefaultRoot, getDrivePath, getDrivePath, getFileExt, getFileExt, getFlags, getGroup, getIcon, getInfo, getModified, getName, getNew, getNew, getNewFile, getNewFile, getNewFile, getOwner, getParent, getParentFile, getPermissionsAndFlags, getProgramDirectory, getPropertiesString, getSetInfo, getText, getTrueChild, getTrueParent, hashCode, isAbsolute, isFile, isHidden, isSameFileSystem, isSameVolume, lastModified, list, list, listMultiple, listRoots, listVolumes, makePath, makePath, mkdir, mkdirs, refresh, removeTrailingSlash, removeTrailingSlash, rename, renameTo, roots, setExecutable, setJavaFile, setJavaFile, setLastModified, setModified, setPermissionsAndFlags, setReadable, setReadOnly, setText, setWritable, toReadableStream, toString, toSystemDependantPath, toWritableStream, volumeFlags, volumeProperties, volumes
protected FileAdapter()
protected FileAdapter(String name)
public void set(File parent, String name)
File
public boolean canRead()
File
protected File getNewInstance()
File
getNewInstance
in class File
public abstract boolean createDir()
File
public abstract boolean delete()
File
public abstract boolean exists()
File
public abstract boolean isDirectory()
File
isDirectory
in class File
public boolean isSymbolicLink()
File
isSymbolicLink
in class File
public abstract String getFullPath()
File
getFullPath
in class File
public abstract void deleteOnExit()
File
deleteOnExit
in class File
public final CharArray list(String mask, int listAndSortOptions, CharArray dest) throws IOException
File
list
in class File
mask
- A file mask.listAndSortOptions
- Use the LIST_XXX values OR'ed together.dest
- an optional destination CharArray. If this is null a new one will be created
and returned. The dest array is NOT cleared before the operation.IOException
- if an IO error occurs during the listing.public abstract String[] list(String mask, int listAndSortOptions)
File
The default method calls the list() method and then splits the returned char array.
protected abstract long getSetModified(long time, boolean doGet) throws IOException
File
getSetModified
in class File
IOException
public abstract boolean move(File newFile)
File
public Wrapper getInfo(int infoCode, Wrapper sourceParameters, int options)
File
getInfo
in class File
infoCode
- one of the INFO_ codes.options
- Options or possibly an index value for the info to get.public boolean setInfo(int infoCode, Wrapper sourceParameters, int options)
protected int getSetPermissionsAndFlags(boolean isGet, int valuesToSetOrGet, int valuesToClear) throws IOException
File
If isGet is true, then the valuesToSetOrGet parameter will hold the flags that the user is interested in.
If isGet is false, then the valuesToSetOrGet parameter will hold the flags to set and the valuesToClear parameter will hold the flags to clear.
The method should return the final flags for the file.
getSetPermissionsAndFlags
in class File
IOException
public int getSupportedPermissionsAndFlags(int interestedFlags)
getSupportedPermissionsAndFlags
in class File
interestedFlags
- the flags you wish to check OR'ed together.public boolean createSymbolicLink(String target)
createSymbolicLink
in class File
target
- the file to link to.public File getSymbolicLinkTarget()
getSymbolicLinkTarget
in class File
public File toJavaFile()
toJavaFile
in class File
public RandomStream toRandomStream(String mode) throws IOException
toRandomStream
in class File
mode
- must be "r" or "rw".IOException
- if an open stream could not be created.IllegalArgument
- exception if mode is not "r" or "rw"