JDK-4084666 : Folder class to encapsulate the details of a file on a particular file system
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.1.3
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_95
  • CPU: x86
  • Submitted: 1997-10-07
  • Updated: 2009-02-16
  • Resolved: 2009-02-16
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Name: sg39081			Date: 10/07/97

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.


WORK AROUND Name: sg39081 Date: 10/07/97 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. -- mr@eng 10/7/1997