2.4.5 - Logical File Paths - JdlLogicalFilePaths

John W. Campbell

2.4.5.1 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
Constructor
Methods

2.4.5.2 Class Details

Package:
Jdl.JdlLib;
Class name:
JdlLogicalFilePaths
Class definition:
public class JdlLogicalFilePaths
Extends:
Object
Implements:
none
Actions:
none

2.4.5.3 Accessible Fields

No fields with public, package or protected access defined.

2.4.5.4 Constructor

2.4.5.4.1 Introduction

A single constructor is available.

Constructor:

Default constructor

2.4.5.4.2 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

2.4.5.5 Methods

2.4.5.5.1 Introduction

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

Methods:

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

2.4.5.5.2 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:
none
Method Return:
Returns true if logical names have been defined in the required file or false if they have not.

2.4.5.5.3 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:
filename
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).

2.4.5.5.4 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:
none
Method Return:
Returns true if the file name was expanded, otherwise false.

⇑ Up 2   ⇑ Up 1   ⇑ Top of this