org.freehep.application.services
Interface FileAccess

All Known Implementing Classes:
JNLPFileAccess

public interface FileAccess

Encapsulates access to a File in a way which will work with unsigned java web start apps. This interface can also be used by applications.

Version:
$Id: FileAccess.java 8584 2006-08-10 23:06:37Z duns $
Author:
tonyj

Method Summary
 boolean canRead()
          Returns whether the file can be read.
 boolean canWrite()
          Returns whether the file can be written to.
 File getFile()
          Applications that need direct access to the underlying File can call this method, but it breaks the JNLP encapsualtion and will throw a SecurityException if used from an unsigned JNLP application.
 InputStream getInputStream()
          Gets an InputStream from the file.
 long getLength()
          Gets the length of the file
 long getMaxLength()
          Gets the maximum length of this file.
 String getName()
          Gets the file name as a string
 OutputStream getOutputStream(boolean append)
          Gets an OutputStream to the file.
 long setMaxLength(long length)
          Sets the maximum file length for the file.
 

Method Detail

canRead

boolean canRead()
                throws IOException
Returns whether the file can be read.

Throws:
IOException

canWrite

boolean canWrite()
                 throws IOException
Returns whether the file can be written to.

Throws:
IOException

getInputStream

InputStream getInputStream()
                           throws IOException
Gets an InputStream from the file.

Throws:
IOException

getOutputStream

OutputStream getOutputStream(boolean append)
                             throws IOException
Gets an OutputStream to the file.

Throws:
IOException

getName

String getName()
               throws IOException
Gets the file name as a string

Throws:
IOException

getLength

long getLength()
               throws IOException
Gets the length of the file

Throws:
IOException

getMaxLength

long getMaxLength()
                  throws IOException
Gets the maximum length of this file. If the length is not limited returns a very large number

Throws:
IOException

setMaxLength

long setMaxLength(long length)
                  throws IOException
Sets the maximum file length for the file.

Throws:
IOException

getFile

File getFile()
             throws IOException,
                    SecurityException
Applications that need direct access to the underlying File can call this method, but it breaks the JNLP encapsualtion and will throw a SecurityException if used from an unsigned JNLP application.

Throws:
IOException
SecurityException


Copyright © 2000-2006 FreeHEP. All Rights Reserved.