S-PLUS Connect/Java v1.0

com.insightful.splus.client
Class ServerFile

java.lang.Object
  extended byjava.io.File
      extended bycom.insightful.splus.client.ServerFile
All Implemented Interfaces:
Comparable, Serializable

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
compareTo, 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()

canWrite

public boolean canWrite()

compareTo

public int compareTo(File pathname)

createNewFile

public boolean createNewFile()

createTempFile

public static File createTempFile(String prefix,
                                  String suffix)

createTempFile

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

delete

public boolean delete()

deleteOnExit

public void deleteOnExit()

equals

public boolean equals(Object obj)

setExists

public void setExists(boolean ex)

exists

public boolean exists()

getAbsoluteFile

public File getAbsoluteFile()

getAbsolutePath

public String getAbsolutePath()

getCanonicalFile

public File getCanonicalFile()

getCanonicalPath

public String getCanonicalPath()

getName

public String getName()

getParent

public String getParent()

getParentFile

public File getParentFile()

getPath

public String getPath()

hashCode

public int hashCode()

isAbsolute

public boolean isAbsolute()

setIsDir

public void setIsDir(boolean dir)

isDirectory

public boolean isDirectory()

isFile

public boolean isFile()

isHidden

public boolean isHidden()

lastModified

public long lastModified()

length

public long length()

list

public String[] list()

list

public String[] list(FilenameFilter filter)

listFiles

public File[] listFiles()

listFiles

public File[] listFiles(FileFilter filter)

listFiles

public File[] listFiles(FilenameFilter filter)

listRoots

public static File[] listRoots()

mkdir

public boolean mkdir()

mkdirs

public boolean mkdirs()

renameTo

public boolean renameTo(File dest)

setLastModified

public boolean setLastModified(long time)

setLength

public boolean setLength(long len)

setReadOnly

public boolean setReadOnly()

toString

public String toString()

toURL

public URL toURL()

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.