Secure FTP Factory

com.jscape.inet.file
Interface JFile


public interface JFile

An abstract representation of file, directory or other type pathnames.

Version:
1.0
Author:
Alex Usun

Method Summary
 void createNewDirectory()
          Creates the directory named by this abstract pathname if and only if a file with this name does not yet exist.
 void createNewFile()
          Creates a new, empty file named by this abstract pathname if and only if a file with this name does not yet exist.
 void createNewLink(JFile target)
          Creates the symbolic link named by this abstract pathname if and only if a file with this name does not yet exist.
 void delete()
          Deletes the file or directory denoted by this abstract pathname.
 void deleteRecursive()
          Recursively deletes the file or directory denoted by this abstract pathname.
 boolean exists()
          Tests whether the file denoted by this abstract pathname exists.
 long getAccessTime()
          Returns the file access time as seconds from Jan 1, 1970 in UTC.
 long getAccessTimeNsec()
          Returns the additional file access time nano-seconds.
 JAcl[] getAcl()
          Obtains the file ACL array similar to that defined in section 5.9 of NFS version 4 Protocol
 long getCreationTime()
          Returns the file creation time as seconds from Jan 1, 1970 in UTC.
 long getCreationTimeNsec()
          Returns the additional file creation time nano-seconds.
 java.lang.String getFilename()
          Returns the name of the file or directory denoted by this abstract pathname.
 long getFilesize()
          Returns the size of the file denoted by this abstract pathname.
 JFileSystem getFileSystem()
          Returns the underlayed file system object.
 java.lang.String getGroup()
          Returns the owner group name for this abstract pathname as string.
 JFile getLinkTarget()
          Returns the link target if the current file is symbolic link.
 long getModificationTime()
          Returns the file modification time as seconds from Jan 1, 1970 in UTC.
 long getModificationTimeNsec()
          Returns the additional file modification time nano-seconds.
 java.lang.String getOwner()
          Returns the owner name for this abstract pathname as string.
 JFile getParentFile()
          Returns the abstract pathname of this abstract pathname's parent.
 java.lang.String getPath()
          Converts this abstract pathname into a pathname string.
 JFilePermissions getPermissions()
          Returns the POSIX file permissions for this abstract pathname.
 JRandomAccessFile getRandomAccessFile(com.jscape.inet.file.JFileOpenFlags openFlags, JAcl.Mask accessType)
          Provides access to the file contents returning a new JRandomAccessFile instance.
 JFileType getType()
          Returns the POSIX file type represented by this abstract pathname.
 boolean isAppendOnly()
          Tests whether the file named by this abstract pathname can only be opened for writing in append mode.
 boolean isArchive()
          Tests whether the file named by this abstract pathname should be included in backup / archive operations.
 boolean isCaseInsensitive()
          This attribute can only apply to directories.
 boolean isCompressed()
          Tests whether the file named by this abstract pathname is compressed.
 boolean isDirectory()
          Tests whether the file denoted by this abstract pathname is a directory.
 boolean isEncrypted()
          Tests whether the file named by this abstract pathname is encrypted.
 boolean isHidden()
          Tests whether the file named by this abstract pathname is a hidden file.
 boolean isImmutable()
          Tests whether the file named by this abstract pathname cannot be deleted or renamed, no hard link can be created to this file and no data can be written to the file.
 boolean isReadOnly()
          Tests whether the file named by this abstract pathname is not writable.
 boolean isSparse()
          Tests whether the file named by this abstract pathname is sparse.
 boolean isSync()
          Tests whether the file named by this abstract pathname when is modified, the changes are written synchronously to the disk.
 boolean isSystem()
          Tests whether the file named by this abstract pathname is part of operating system.
 JFile[] listFiles()
          Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname.
 JFile[] listFiles(com.jscape.inet.file.JFileFilter filter)
          Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter.
 void renameTo(JFile dest)
          Renames the file denoted by this abstract pathname.
 void setAcl(JAcl[] acls)
          Setups the file ACL's.
 void setArchive(boolean archive)
          Setups archive attribute for this file.
 void setGroup(java.lang.String group)
          Setups the new file owner group
 void setImmutable(boolean immutable)
          Setups file immutability.
 void setOwner(java.lang.String owner)
          Setups the new file owner.
 void setPermissions(JFilePermissions permissions)
          Setups the new file permissions.
 void setSync(boolean sync)
          Setups file changes synchronization mode.
 

Method Detail

getFilename

java.lang.String getFilename()
Returns the name of the file or directory denoted by this abstract pathname.

Returns:
the name of the file or directory denoted by this abstract pathname

getPath

java.lang.String getPath()
Converts this abstract pathname into a pathname string.

Returns:
the string form of this abstract pathname

getParentFile

JFile getParentFile()
Returns the abstract pathname of this abstract pathname's parent.

Returns:
the abstract pathname of the parent directory named by this abstract pathname

getType

JFileType getType()
                  throws java.io.IOException
Returns the POSIX file type represented by this abstract pathname.

Returns:
the POSIX file type represented by this abstract pathname
Throws:
java.io.IOException - if an I/O error occured

isDirectory

boolean isDirectory()
                    throws java.io.IOException
Tests whether the file denoted by this abstract pathname is a directory.

Returns:
true if and only if the file denoted by this abstract pathname exists and is a directory; false otherwise
Throws:
java.io.IOException - if an I/O error occured

getFilesize

long getFilesize()
                 throws java.io.IOException
Returns the size of the file denoted by this abstract pathname.

Returns:
the size, in bytes, of the file denoted by this abstract pathname, or 0L if the file does not exist
Throws:
java.io.IOException - if an I/O error occured

getOwner

java.lang.String getOwner()
                          throws java.io.IOException
Returns the owner name for this abstract pathname as string.

Returns:
the owner name for this abstract pathname as string
Throws:
java.io.IOException - if an I/O error occured

setOwner

void setOwner(java.lang.String owner)
              throws java.io.IOException
Setups the new file owner.

Parameters:
owner - the new file owner
Throws:
java.io.IOException - if an I/O error occured

getGroup

java.lang.String getGroup()
                          throws java.io.IOException
Returns the owner group name for this abstract pathname as string.

Returns:
the owner gropu name for this abstract pathname as string
Throws:
java.io.IOException - if an I/O error occured

setGroup

void setGroup(java.lang.String group)
              throws java.io.IOException
Setups the new file owner group

Parameters:
group - the new file owner group
Throws:
java.io.IOException - if an I/O error occured

getPermissions

JFilePermissions getPermissions()
                                throws java.io.IOException
Returns the POSIX file permissions for this abstract pathname.

Returns:
the POSIX file permissions for this abstract pathname
Throws:
java.io.IOException - if an I/O error occured

setPermissions

void setPermissions(JFilePermissions permissions)
                    throws java.io.IOException
Setups the new file permissions.

Parameters:
permissions - the new file permissions
Throws:
java.io.IOException - if an I/O error occured

getAccessTime

long getAccessTime()
                   throws java.io.IOException
Returns the file access time as seconds from Jan 1, 1970 in UTC. A negative value indicates number of seconds before Jan 1, 1970.

Returns:
the file access time in seconds
Throws:
java.io.IOException - if an I/O error occured

getAccessTimeNsec

long getAccessTimeNsec()
                       throws java.io.IOException
Returns the additional file access time nano-seconds.

Returns:
the additional file access time nano-seconds
Throws:
java.io.IOException - if an I/O error occured

getCreationTime

long getCreationTime()
                     throws java.io.IOException
Returns the file creation time as seconds from Jan 1, 1970 in UTC. A negative value indicates number of seconds before Jan 1, 1970.

Returns:
the file creation time in seconds
Throws:
java.io.IOException - if an I/O error occured

getCreationTimeNsec

long getCreationTimeNsec()
                         throws java.io.IOException
Returns the additional file creation time nano-seconds.

Returns:
the additional file creation time nano-seconds
Throws:
java.io.IOException - if an I/O error occured

getModificationTime

long getModificationTime()
                         throws java.io.IOException
Returns the file modification time as seconds from Jan 1, 1970 in UTC. A negative value indicates number of seconds before Jan 1, 1970.

Returns:
the file modification time in seconds
Throws:
java.io.IOException - if an I/O error occured

getModificationTimeNsec

long getModificationTimeNsec()
                             throws java.io.IOException
Returns the additional file modification time nano-seconds.

Returns:
the additional file modification time nano-seconds
Throws:
java.io.IOException - if an I/O error occured

getAcl

JAcl[] getAcl()
              throws java.io.IOException
Obtains the file ACL array similar to that defined in section 5.9 of NFS version 4 Protocol

Returns:
the file ACL
Throws:
java.io.IOException - if an I/O error occured

setAcl

void setAcl(JAcl[] acls)
            throws java.io.IOException
Setups the file ACL's.

Parameters:
acls - the new file ACL's
Throws:
java.io.IOException - if an I/O error occured

isReadOnly

boolean isReadOnly()
                   throws java.io.IOException
Tests whether the file named by this abstract pathname is not writable.

Returns:
true if and only if the file denoted by this abstract pathname is not writable; false otherwise
Throws:
java.io.IOException - if an I/O error occured

isSystem

boolean isSystem()
                 throws java.io.IOException
Tests whether the file named by this abstract pathname is part of operating system.

Returns:
true if and only if the file denoted by this abstract pathname is part of operation system; false otherwise
Throws:
java.io.IOException - if an I/O error occured

isHidden

boolean isHidden()
                 throws java.io.IOException
Tests whether the file named by this abstract pathname is a hidden file.

Returns:
true if and only if the file denoted by this abstract pathname is hidden according to the conventions of the underlying platform; false otherwise
Throws:
java.io.IOException - if an I/O error occured

isCaseInsensitive

boolean isCaseInsensitive()
                          throws java.io.IOException
This attribute can only apply to directories. It means that files and directory names in this directory should be compared without regard to case.

Returns:
true if and only if files and directory names in this directory should be compared without regard to case; false otherwise
Throws:
java.io.IOException - if an I/O error occured

isArchive

boolean isArchive()
                  throws java.io.IOException
Tests whether the file named by this abstract pathname should be included in backup / archive operations.

Returns:
true if and only if the file denoted by this abstract pathname should be included in backup / archive operations; false otherwise
Throws:
java.io.IOException - if an I/O error occured

setArchive

void setArchive(boolean archive)
                throws java.io.IOException
Setups archive attribute for this file.

Parameters:
archive - if true the file denoted by this abstract pathname should be included in backup / archive operations
Throws:
java.io.IOException - if an I/O error occured

isEncrypted

boolean isEncrypted()
                    throws java.io.IOException
Tests whether the file named by this abstract pathname is encrypted.

Returns:
true if and only if the file denoted by this abstract pathname is encrypted; false otherwise
Throws:
java.io.IOException - if an I/O error occured

isCompressed

boolean isCompressed()
                     throws java.io.IOException
Tests whether the file named by this abstract pathname is compressed.

Returns:
true if and only if the file denoted by this abstract pathname is compressed; false otherwise
Throws:
java.io.IOException - if an I/O error occured

isSparse

boolean isSparse()
                 throws java.io.IOException
Tests whether the file named by this abstract pathname is sparse. This means that file blocks that have not been explicitly written are not stored on disk. For example, if a client writes a buffer at 10 Mb from the beginning of the file, the blocks between the previous EOF marker and the 10 Mb offset would not consume physical disk space. Some systems may store all files as sparse files, in which case this attribute will be unconditionally set. Other systems may not have a mechanism for determining if the file is sparse, and so the file MAY be stored sparse even if this flag is not set.

Returns:
true if and only if the file denoted by this abstract pathname is sparse; false otherwise
Throws:
java.io.IOException - if an I/O error occured

isAppendOnly

boolean isAppendOnly()
                     throws java.io.IOException
Tests whether the file named by this abstract pathname can only be opened for writing in append mode.

Returns:
true if and only if the file denoted by this abstract pathname can only be opened for writing in append mode; false otherwise
Throws:
java.io.IOException - if an I/O error occured

isImmutable

boolean isImmutable()
                    throws java.io.IOException
Tests whether the file named by this abstract pathname cannot be deleted or renamed, no hard link can be created to this file and no data can be written to the file.

Returns:
true if and only if the file denoted by this abstract pathname is immutable; false otherwise
Throws:
java.io.IOException - if an I/O error occured

setImmutable

void setImmutable(boolean immutable)
                  throws java.io.IOException
Setups file immutability. Typically only the superuser can set or remove this attribute.

Parameters:
immutable - if true the file becames immutable
Throws:
java.io.IOException - if an I/O error occured

isSync

boolean isSync()
               throws java.io.IOException
Tests whether the file named by this abstract pathname when is modified, the changes are written synchronously to the disk.

Returns:
true if and only if the file denoted by this abstract pathname is sync; false otherwise
Throws:
java.io.IOException - if an I/O error occured

setSync

void setSync(boolean sync)
             throws java.io.IOException
Setups file changes synchronization mode.

Parameters:
sync - if true the changes to this file must be written synchronously to the disk
Throws:
java.io.IOException - if an I/O error occured

exists

boolean exists()
               throws java.io.IOException
Tests whether the file denoted by this abstract pathname exists.

Returns:
true if and only if the file denoted by this abstract pathname exists; false otherwise
Throws:
java.io.IOException - if an I/O error occured

createNewFile

void createNewFile()
                   throws java.io.IOException
Creates a new, empty file named by this abstract pathname if and only if a file with this name does not yet exist.

Throws:
java.io.IOException - if an I/O error occurred

createNewDirectory

void createNewDirectory()
                        throws java.io.IOException
Creates the directory named by this abstract pathname if and only if a file with this name does not yet exist.

Throws:
java.io.IOException - if an I/O error occurred

createNewLink

void createNewLink(JFile target)
                   throws java.io.IOException
Creates the symbolic link named by this abstract pathname if and only if a file with this name does not yet exist.

Parameters:
target - target file for the link
Throws:
java.io.IOException - if an I/O error occurred

renameTo

void renameTo(JFile dest)
              throws java.io.IOException
Renames the file denoted by this abstract pathname.

Parameters:
dest - the new abstract pathname for the named file
Throws:
java.io.IOException - if an I/O error occurred

delete

void delete()
            throws java.io.IOException
Deletes the file or directory denoted by this abstract pathname. If this pathname denotes a directory, then the directory must be empty in order to be deleted.

Throws:
java.io.IOException - if an I/O error occurred

deleteRecursive

void deleteRecursive()
                     throws java.io.IOException
Recursively deletes the file or directory denoted by this abstract pathname.

Throws:
java.io.IOException - if an I/O error occurred

listFiles

JFile[] listFiles()
                  throws java.io.IOException
Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname.

Returns:
an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname. The array will be empty if the directory is empty.
Throws:
java.io.IOException - if an I/O error occurred

listFiles

JFile[] listFiles(com.jscape.inet.file.JFileFilter filter)
                  throws java.io.IOException
Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter.

Parameters:
filter - a file filter
Returns:
an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname. The array will be empty if the directory is empty.
Throws:
java.io.IOException - if an I/O error occurred

getLinkTarget

JFile getLinkTarget()
                    throws java.io.IOException
Returns the link target if the current file is symbolic link.

Returns:
the link target
Throws:
java.io.IOException - if an I/O error occured

getRandomAccessFile

JRandomAccessFile getRandomAccessFile(com.jscape.inet.file.JFileOpenFlags openFlags,
                                      JAcl.Mask accessType)
                                      throws java.io.IOException
Provides access to the file contents returning a new JRandomAccessFile instance.

Parameters:
openFlags - the file open flags
accessType - desired access type
Returns:
a new JRandomAccessFile instance
Throws:
java.io.IOException - if an I/O error occurred

getFileSystem

JFileSystem getFileSystem()
Returns the underlayed file system object.

Returns:
the underlayed file system object

Secure FTP Factory

Copyright © JSCAPE LLC. 1999-2014. All Rights Reserved