FreeHEP API
Version current

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,v 1.1 2001/02/23 01:18:07 tonyj Exp $
Author:
tonyj
Source Code:
FileAccess.java

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

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

Throws:
IOException

canWrite

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

Throws:
IOException

getInputStream

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

Throws:
IOException

getOutputStream

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

Throws:
IOException

getName

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

Throws:
IOException

getLength

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

Throws:
IOException

getMaxLength

public 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

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

Throws:
IOException

getFile

public 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

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.