S-PLUS Connect/Java v1.0

com.insightful.splus.client
Class ServerFile

java.lang.Object
  extended by java.io.File
      extended by com.insightful.splus.client.ServerFile
All Implemented Interfaces:
Serializable, Comparable<File>

public class ServerFile
extends File

Object representing a file on the server, with constructor to specify information on whether it is a directory.
This was created for use with a JFileChooser. Information on directory status is stored in the ServerFile to minimize engine queries. Many methods are not implemented, and throw an UnsupportedOperationException.
If directory status is not specified in the constructor, it is queried when isDirectory() is called.
Static booleans are stored indicating whether to check readable, writable, and exists status, or to just always return true for canRead(), canWrite(), and canExists(). These were added to suppress unnecessary engine queries by calls from standard JFileChooser-related classes. They may be set using setCheckReadable(), setCheckWritable(), setCheckExists().

See Also:
Serialized Form

Field Summary
static String SERVER_ROOT
           
static int SERVER_ROOT_LENGTH
           
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
ServerFile(File parent, String child)
          Override the default File constructor and set local variables.
ServerFile(File parent, String child, boolean isDir)
          Constructor where the directory status is specified.
ServerFile(String pathname)
          Override the default File constructor and set local variables.
ServerFile(String pathname, boolean isDir)
          Constructor where the directory status is specified.
ServerFile(String parent, String child)
          Override the default File constructor and set local variables.
ServerFile(String parent, String child, boolean isDir)
          Constructor where the directory status is specified.
 
Method Summary
 boolean canRead()
           
 boolean canWrite()
           
 int compareTo(File pathname)
           
static String convertServerFilePath(String filePath)
           
 boolean createNewFile()
           
static File createTempFile(String prefix, String suffix)
           
static File createTempFile(String prefix, String suffix, File directory)
           
 boolean delete()
           
 void deleteOnExit()
           
 boolean equals(Object obj)
           
 boolean exists()
           
 File getAbsoluteFile()
           
 String getAbsolutePath()
           
 File getCanonicalFile()
           
 String getCanonicalPath()
           
 String getName()
           
 String getParent()
           
 File getParentFile()
           
 String getPath()
           
 int hashCode()
           
 boolean isAbsolute()
           
 boolean isDirectory()
           
 boolean isFile()
           
 boolean isHidden()
           
 long lastModified()
           
 long length()
           
 String[] list()
           
 String[] list(FilenameFilter filter)
           
 File[] listFiles()
           
 File[] listFiles(FileFilter filter)
           
 File[] listFiles(FilenameFilter filter)
           
static File[] listRoots()
           
 boolean mkdir()
           
 boolean mkdirs()
           
 boolean renameTo(File dest)
           
 void setCanRead(boolean read)
           
 void setCanWrite(boolean write)
           
static boolean setCheckExists(boolean check)
           
static boolean setCheckReadable(boolean check)
          Method to check whether to do engine queries or just return true.
static boolean setCheckWritable(boolean check)
           
 void setExists(boolean ex)
           
 void setIsDir(boolean dir)
           
 boolean setLastModified(long time)
           
 boolean setLength(long len)
           
 boolean setReadOnly()
           
 String toString()
           
 URL toURL()
           
 
Methods inherited from class java.io.File
toURI
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SERVER_ROOT

public static final String SERVER_ROOT
See Also:
Constant Field Values

SERVER_ROOT_LENGTH

public static final int SERVER_ROOT_LENGTH
Constructor Detail

ServerFile

public ServerFile(String pathname)
Override the default File constructor and set local variables.


ServerFile

public ServerFile(File parent,
                  String child)
Override the default File constructor and set local variables.


ServerFile

public ServerFile(String parent,
                  String child)
Override the default File constructor and set local variables.


ServerFile

public ServerFile(String pathname,
                  boolean isDir)
Constructor where the directory status is specified. It's less expensive to query engine once for many files and specify their status in the constructor than to do one query per file.


ServerFile

public ServerFile(File parent,
                  String child,
                  boolean isDir)
Constructor where the directory status is specified.


ServerFile

public ServerFile(String parent,
                  String child,
                  boolean isDir)
Constructor where the directory status is specified.

Method Detail

convertServerFilePath

public static String convertServerFilePath(String filePath)

setCanRead

public void setCanRead(boolean read)

setCanWrite

public void setCanWrite(boolean write)

canRead

public boolean canRead()
Overrides:
canRead in class File

canWrite

public boolean canWrite()
Overrides:
canWrite in class File

compareTo

public int compareTo(File pathname)
Specified by:
compareTo in interface Comparable<File>
Overrides:
compareTo in class File

createNewFile

public boolean createNewFile()
Overrides:
createNewFile in class File

createTempFile

public static File createTempFile(String prefix,
                                  String suffix)

createTempFile

public static File createTempFile(String prefix,
                                  String suffix,
                                  File directory)

delete

public boolean delete()
Overrides:
delete in class File

deleteOnExit

public void deleteOnExit()
Overrides:
deleteOnExit in class File

equals

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

setExists

public void setExists(boolean ex)

exists

public boolean exists()
Overrides:
exists in class File

getAbsoluteFile

public File getAbsoluteFile()
Overrides:
getAbsoluteFile in class File

getAbsolutePath

public String getAbsolutePath()
Overrides:
getAbsolutePath in class File

getCanonicalFile

public File getCanonicalFile()
Overrides:
getCanonicalFile in class File

getCanonicalPath

public String getCanonicalPath()
Overrides:
getCanonicalPath in class File

getName

public String getName()
Overrides:
getName in class File

getParent

public String getParent()
Overrides:
getParent in class File

getParentFile

public File getParentFile()
Overrides:
getParentFile in class File

getPath

public String getPath()
Overrides:
getPath in class File

hashCode

public int hashCode()
Overrides:
hashCode in class File

isAbsolute

public boolean isAbsolute()
Overrides:
isAbsolute in class File

setIsDir

public void setIsDir(boolean dir)

isDirectory

public boolean isDirectory()
Overrides:
isDirectory in class File

isFile

public boolean isFile()
Overrides:
isFile in class File

isHidden

public boolean isHidden()
Overrides:
isHidden in class File

lastModified

public long lastModified()
Overrides:
lastModified in class File

length

public long length()
Overrides:
length in class File

list

public String[] list()
Overrides:
list in class File

list

public String[] list(FilenameFilter filter)
Overrides:
list in class File

listFiles

public File[] listFiles()
Overrides:
listFiles in class File

listFiles

public File[] listFiles(FileFilter filter)
Overrides:
listFiles in class File

listFiles

public File[] listFiles(FilenameFilter filter)
Overrides:
listFiles in class File

listRoots

public static File[] listRoots()

mkdir

public boolean mkdir()
Overrides:
mkdir in class File

mkdirs

public boolean mkdirs()
Overrides:
mkdirs in class File

renameTo

public boolean renameTo(File dest)
Overrides:
renameTo in class File

setLastModified

public boolean setLastModified(long time)
Overrides:
setLastModified in class File

setLength

public boolean setLength(long len)

setReadOnly

public boolean setReadOnly()
Overrides:
setReadOnly in class File

toString

public String toString()
Overrides:
toString in class File

toURL

public URL toURL()
Overrides:
toURL in class File

setCheckReadable

public static boolean setCheckReadable(boolean check)
Method to check whether to do engine queries or just return true. Avoiding the checks reduces unnecessary calls to the engine.

Parameters:
check - indicate whether to actually check the file status
Returns:
initial value of the check flag

setCheckWritable

public static boolean setCheckWritable(boolean check)

setCheckExists

public static boolean setCheckExists(boolean check)

S-PLUS Connect/Java v1.0

Copyright © 2000, 2002 Insightful Corporation
Warning: Classes not documented in the S-PLUS Programmer's Guide may change in future releases.