wt.security
Class FileAccess

java.lang.Object
  extended by wt.security.Access
      extended by wt.security.FileAccess

public class FileAccess
extends wt.security.Access

Class that provides wrappers to priviledged file methods using the wt.security package. This allows applets to perform file operations that are typically restricted by the sandbox.

Supported API: true


Method Summary
 boolean canRead(File file)
          Wrapper for File.canRead()
 boolean canWrite(File file)
          Wrapper for File.canWrite()
 boolean delete(File file)
          Wrapper for File.delete()
 boolean exists(File file)
          Wrapper for File.exists()
 boolean fileEquals(File file0, File file1)
          Wrapper for File.equals()
 String getAbsolutePath(File file)
          Wrapper for File.getAbsolutePath()
 String getCanonicalPath(File file)
          Wrapper for File.getCanonicalPath()
static FileAccess getFileAccess()
          Get instance of FileAccess.
static FileAccess getFileAccess(Frame parentFrame)
          Get instance of FileAccess.
 FileInputStream getFileInputStream(File file)
          Wrapper for FileInputStream constructor.
 FileInputStream getFileInputStream(FileDescriptor file)
          Wrapper for FileInputStream constructor.
 FileInputStream getFileInputStream(String file)
          Wrapper for FileInputStream constructor.
 FileOutputStream getFileOutputStream(File file)
          Wrapper for FileOutputStream constructor.
 FileOutputStream getFileOutputStream(FileDescriptor file)
          Wrapper for FileOutputStream constructor.
 FileOutputStream getFileOutputStream(String file)
          Wrapper for FileOutputStream constructor.
 FileOutputStream getFileOutputStream(String file, boolean append)
          Wrapper for FileOutputStream constructor.
 String getParent(File file)
          Wrapper for File.getParent()
 boolean isAbsolute(File file)
          Wrapper for File.isAbsolute()
 boolean isDirectory(File file)
          Wrapper for File.isDirectory()
 boolean isFile(File file)
          Wrapper for File.isFile()
protected  void JFileChooser_setCurrentDirectory(wt.security.WTJFileChooser jfc, File dir)
          Wrapper for JFileChooser.setCurrentDirectory().
 void JFileChooser_setSelectedFile(wt.security.WTJFileChooser jfc, File file)
          Wrapper for JFileChooser.setSelectedFile().
 void JFileChooser_setSelectedFiles(wt.security.WTJFileChooser jfc, File[] files)
          Wrapper for JFileChooser.setSelectedFiles().
protected  int JFileChooser_showDialog(wt.security.WTJFileChooser jfc, Component parent, String text)
          Wrapper for JFileChooser.showDialog().
 long lastModified(File file)
          Wrapper for File.lastModified()
 long length(File file)
          Wrapper for File.length()
 String[] list(File file)
          Wrapper for File.list()
 File[] listFiles(File file)
          Wrapper for File.listFiles()
 boolean mkdir(File file)
          Wrapper for File.mkdir()
 boolean mkdirs(File file)
          Wrapper for File.mkdirs()
 FileDialog newFileDialog(Frame frame)
          Wrapper for new FileDialog().
 JFileChooser newJFileChooser()
          Wrapper for new JFileChooser().
 JFileChooser newJFileChooser(File currentDirectory)
          Wrapper for new JFileChooser(File).
 boolean renameTo(File from, File to)
          Wrapper for File.renameTo()
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFileAccess

public static FileAccess getFileAccess(Frame parentFrame)
Get instance of FileAccess. This instance can then be used to perform file operation that are typically restricted by the sandbox.

Parameters:
parentFrame - the parent frame for security dialog boxes that may be presented

Supported API: true

getFileAccess

public static FileAccess getFileAccess()
Get instance of FileAccess. This instance can then be used to perform file operation that are typically restricted by the sandbox.

Supported API: true


getFileInputStream

public final FileInputStream getFileInputStream(String file)
                                         throws WTSecurityException,
                                                FileNotFoundException
Wrapper for FileInputStream constructor.

Parameters:
file - the filename for the file to be opened for the input stream

Supported API: true
Throws:
WTSecurityException
FileNotFoundException

getFileInputStream

public final FileInputStream getFileInputStream(File file)
                                         throws WTSecurityException,
                                                FileNotFoundException
Wrapper for FileInputStream constructor.

Parameters:
file - the file to be opened for the input stream

Supported API: true
Throws:
WTSecurityException
FileNotFoundException

getFileInputStream

public final FileInputStream getFileInputStream(FileDescriptor file)
                                         throws WTSecurityException
Wrapper for FileInputStream constructor.

Parameters:
file - the file descriptor of the file to be opened for the input stream

Supported API: true
Throws:
WTSecurityException

getFileOutputStream

public final FileOutputStream getFileOutputStream(File file)
                                           throws WTSecurityException,
                                                  IOException
Wrapper for FileOutputStream constructor.

Parameters:
file - the file to be opened for the output stream

Supported API: true
Throws:
WTSecurityException
IOException

getFileOutputStream

public final FileOutputStream getFileOutputStream(FileDescriptor file)
                                           throws WTSecurityException
Wrapper for FileOutputStream constructor.

Parameters:
file - the file descriptor to the file to be opened for the output stream

Supported API: true
Throws:
WTSecurityException

getFileOutputStream

public final FileOutputStream getFileOutputStream(String file)
                                           throws WTSecurityException,
                                                  IOException
Wrapper for FileOutputStream constructor.

Parameters:
file - the filename to the file to be opened for the output stream

Supported API: true
Throws:
WTSecurityException
IOException

getFileOutputStream

public final FileOutputStream getFileOutputStream(String file,
                                                  boolean append)
                                           throws WTSecurityException,
                                                  IOException
Wrapper for FileOutputStream constructor.

Parameters:
file - the filename to the file to be opened for the output stream
append - boolean stating if the file should be appended to

Supported API: true
Throws:
WTSecurityException
IOException

exists

public final boolean exists(File file)
                     throws WTSecurityException
Wrapper for File.exists()

Parameters:
file - the file the operation is being performed upon

Supported API: true
Throws:
WTSecurityException

list

public final String[] list(File file)
                    throws WTSecurityException
Wrapper for File.list()

Parameters:
file - the file the operation is being performed upon

Supported API: true
Throws:
WTSecurityException

listFiles

public final File[] listFiles(File file)
                       throws WTSecurityException
Wrapper for File.listFiles()

Parameters:
file - the file the operation is being performed upon

Supported API: true
Throws:
WTSecurityException

isFile

public final boolean isFile(File file)
                     throws WTSecurityException
Wrapper for File.isFile()

Parameters:
file - the file the operation is being performed upon

Supported API: true
Throws:
WTSecurityException

isDirectory

public final boolean isDirectory(File file)
                          throws WTSecurityException
Wrapper for File.isDirectory()

Parameters:
file - the file the operation is being performed upon

Supported API: true
Throws:
WTSecurityException

isAbsolute

public final boolean isAbsolute(File file)
                         throws WTSecurityException
Wrapper for File.isAbsolute()

Parameters:
file - the file the operation is being performed upon

Supported API: true
Throws:
WTSecurityException

lastModified

public final long lastModified(File file)
                        throws WTSecurityException
Wrapper for File.lastModified()

Parameters:
file - the file the operation is being performed upon

Supported API: true
Throws:
WTSecurityException

length

public final long length(File file)
                  throws WTSecurityException
Wrapper for File.length()

Parameters:
file - the file the operation is being performed upon

Supported API: true
Throws:
WTSecurityException

mkdir

public final boolean mkdir(File file)
                    throws WTSecurityException
Wrapper for File.mkdir()

Parameters:
file - the file the operation is being performed upon

Supported API: true
Throws:
WTSecurityException

mkdirs

public final boolean mkdirs(File file)
                     throws WTSecurityException
Wrapper for File.mkdirs()

Parameters:
file - the file the operation is being performed upon

Supported API: true
Throws:
WTSecurityException

renameTo

public final boolean renameTo(File from,
                              File to)
                       throws WTSecurityException
Wrapper for File.renameTo()

Parameters:
from - the file that is being renamed
to - the file that from is being renamed to

Supported API: true
Throws:
WTSecurityException

delete

public final boolean delete(File file)
                     throws WTSecurityException
Wrapper for File.delete()

Parameters:
file - the file the operation is being performed upon

Supported API: true
Throws:
WTSecurityException

getCanonicalPath

public final String getCanonicalPath(File file)
                              throws WTSecurityException,
                                     IOException
Wrapper for File.getCanonicalPath()

Parameters:
file - the file the operation is being performed upon

Supported API: true
Throws:
WTSecurityException
IOException

getParent

public final String getParent(File file)
                       throws WTSecurityException
Wrapper for File.getParent()

Parameters:
file - the file the operation is being performed upon

Supported API: true
Throws:
WTSecurityException

getAbsolutePath

public final String getAbsolutePath(File file)
                             throws WTSecurityException,
                                    IOException
Wrapper for File.getAbsolutePath()

Parameters:
file - the file the operation is being performed upon

Supported API: true
Throws:
WTSecurityException
IOException

canRead

public final boolean canRead(File file)
                      throws WTSecurityException
Wrapper for File.canRead()

Parameters:
file - the file the operation is being performed upon

Supported API: true
Throws:
WTSecurityException

canWrite

public final boolean canWrite(File file)
                       throws WTSecurityException
Wrapper for File.canWrite()

Parameters:
file - the file the operation is being performed upon

Supported API: true
Throws:
WTSecurityException

fileEquals

public final boolean fileEquals(File file0,
                                File file1)
                         throws WTSecurityException
Wrapper for File.equals()

Parameters:
file - the file the operation is being performed upon

Supported API: true
Throws:
WTSecurityException

newFileDialog

public final FileDialog newFileDialog(Frame frame)
                               throws WTSecurityException
Wrapper for new FileDialog(). This operation requires permission under Internet Explorer.

Parameters:
frame - the parent frame for this newly constructed FileDialog

Supported API: true
Throws:
WTSecurityException

newJFileChooser

public final JFileChooser newJFileChooser()
                                   throws WTSecurityException
Wrapper for new JFileChooser().

Supported API: true

Throws:
WTSecurityException

newJFileChooser

public final JFileChooser newJFileChooser(File currentDirectory)
                                   throws WTSecurityException
Wrapper for new JFileChooser(File).

Supported API: true

Throws:
WTSecurityException

JFileChooser_showDialog

protected final int JFileChooser_showDialog(wt.security.WTJFileChooser jfc,
                                            Component parent,
                                            String text)
                                     throws WTSecurityException
Wrapper for JFileChooser.showDialog().

Parameters:
parent - the parent component of the dialog
text - the text of the ApproveButton

Supported API: true
Throws:
WTSecurityException

JFileChooser_setCurrentDirectory

protected final void JFileChooser_setCurrentDirectory(wt.security.WTJFileChooser jfc,
                                                      File dir)
                                               throws WTSecurityException
Wrapper for JFileChooser.setCurrentDirectory().

Parameters:
dir - the current directory to point to

Supported API: true
Throws:
WTSecurityException

JFileChooser_setSelectedFile

public final void JFileChooser_setSelectedFile(wt.security.WTJFileChooser jfc,
                                               File file)
                                        throws WTSecurityException
Wrapper for JFileChooser.setSelectedFile().

Parameters:
file - the file currently selected

Supported API: true
Throws:
WTSecurityException

JFileChooser_setSelectedFiles

public final void JFileChooser_setSelectedFiles(wt.security.WTJFileChooser jfc,
                                                File[] files)
                                         throws WTSecurityException
Wrapper for JFileChooser.setSelectedFiles().

Parameters:
file - the file currently selected

Supported API: true
Throws:
WTSecurityException