Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4084666
Votes 1
Synopsis Folder class to encapsulate the details of a file on a particular file system
Category java:classes_io
Reported Against 1.1.3
Release Fixed
State 11-Closed, duplicate of 4313887, request for enhancement
Priority: 5-Very Low
Related Bugs 4104990 , 4125893 , 4141996 , 4302202 , 4122085
Submit Date 07-OCT-1997
Description


I'd like to propose the additions:

NEW CLASS:  java.lang.Folder
UPDATE:     java.lang.File

These classes encapsulate the details of a given
file and directory within the file system where a Java
APPLICATION runs.  The current version of java.io.File
is not adequate because it doesn't provide file
attributes, last modification date and time, etc.

I have a version of these classes written in C++ that
used in production under DOS, Windows, NT, and UNIX, and 
NetWare.  The source for the C++ "Directory" (i.e.
"Folder") header file will be presented below.

If you want, I wouldn't mind writing these class 
updates as beans.

Thanks!
======================================================================
Posted Date : 2005-08-25 21:08:36.0
Work Around




Source code:  C++!!!!


#ifndef Directory_CLASS
#define Directory_CLASS   "Directory"

#include "pathstr.h"
#include "strcllct.h"

class Directory : public Object {
  private:


  protected:
  char             cDrive;
  PathString       pathName;
  DWORD            dwSearchAttribute;
  HANDLE           hSearchHandle;
  String           volumeLabel,
                   retString;
  StringCollection list;

  void             Initialize(void);

  void             CleanUp(void);

  void             buildReceiver(char            FAR *szStr);

  void             buildReceiver(void);

  void             getVolumeLabel(void);

  void             getAllFiles(char              FAR *szFilter);

  void             getAllDirs(void);

  void             removeAllFiles(char           FAR *szFilter);


  public:

  // Constructors and destructor for this class.
  Directory(char                  FAR *szPathName);

  Directory(String                FAR &path);

  Directory(void);

  virtual ~Directory(void);

  void             create(void);

  // Answer the disk drive letter of the receiver.  Returns EOS if the drive has 
not been
  // initialized.
  char             drive(void) { return cDrive; }

  String           FAR &drivePathName(void) { retString = pathName.asAsciiZ(); 
return retString; }

  StringCollection FAR &filesNamed(char          FAR *szFilterString);

  StringCollection FAR &filesNamed(String        FAR &filterString);

  BOOL             hasSubdirectory(void);

  void             remove(void);

  StringCollection FAR &subdirectories(void);

  BOOL             valid(void);

  String           FAR &getVolume(void) { return volumeLabel; }

  // E. Ciurana:  Michel Violante's extensions to this class:
  void             deleteFiles(char              FAR *szFilter);

  void             deleteFiles(String            FAR &filter);
};
#endif // Directory_CLASS
======================================================================
Evaluation
Extensions similar to this are already under consideration for a future release
of the JDK.  --   xxxxx@xxxxx   10/7/1997
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang