2.4.5 - Logical File Paths - JdlLogicalFilePaths

John W. Campbell Introduction

This class provides a mechanism to set up logical names to point to directories. It is intended to assist with the input or output of files for applets where the standard Java based file chooser cannot be used because of security restrictions. The logical names must be defined in a file called .java.lfp.txt in the directory pointed to by the Java System Property "user.home". For each required logical name, a line is given with the logical name followed by the required path e.g.
IMAGES C:\Documents and Settings\JOHN\My Documents\image_data

When used from an applet, permission will need to be given to access:-
  1. The system property "user.home".
  2. The file ".java.lfp.txt".
  3. Files in the paths pointed to by the logical names defined in the file ".java.lfp.txt".

Class, constructor and methods:

Class Details
Accessible Fields
Methods Class Details

Class name:
Class definition:
public class JdlLogicalFilePaths
none Accessible Fields

No fields with public, package or protected access defined. Constructor Introduction

A single constructor is available.


Default constructor Default constructor

Constructs a JdlLogicalFilePaths object by reading in the entries from the file .java.lfp.txt in the directory pointed to by the Java System Property "user.home".

Constructor Definition:
public JdlLogicalFilePaths()
Parameters List:
none Methods Introduction

This section contains methods to process the logical names and to return status information.


See if paths defined - pathsDefined
Get full file name - fullFileName
Was name expanded - wasExpanded See if paths defined - pathsDefined

This method tests whether or not any logical name paths have been set up.

Method Definition:
public boolean pathsDefined()
Parameters List:
Method Return:
Returns true if logical names have been defined in the required file or false if they have not. Get full file name - fullFileName

This method expands the file name to give the full file path name from the name specified using the logical name.

Method Definition:
public String fullFileName (String filename)
Parameters List:
The name of the file containing the logical name. If no logical name us given (or one that has not been defined) the file name will be returned unchanged e.g. IMAGE\lys.mar based on a logical name defined as IMAGE.
Method Return:
Returns the expanded file name (or the unmodified file name if a valid logical name was not found). Was name expanded - wasExpanded

Returns a flag indicating whether or not a file name was expanded on the previous call to fullFileName(..).

Method Definition:
public boolean wasExpanded()
Parameters List:
Method Return:
Returns true if the file name was expanded, otherwise false.

⇑ Up 2   ⇑ Up 1   ⇑ Top of this