[1963] in java-interest

home help back first fref pref prev next nref lref last post

Re: Some comments on Java's File class....

daemon@ATHENA.MIT.EDU (Christophe Meessen)
Wed Sep 20 16:55:27 1995

Date: Wed, 20 Sep 1995 18:40:43 +0200
To: arnold@cocolat.east.sun.com (Ken Arnold - Sun Labs)
From: meessen@cppm.in2p3.fr (Christophe Meessen)
Cc: java-interest@java.sun.com


>>1. javadoc missed the [] in String list()[]. This is confusing. Fix javadoc
>>or File class definition. Change into String[] list(); This is also more
>>readable.
>
>You are missing the doc style -- it is String[] list(), using the Java,
>not the C-style, array declaration

In alpha3 on WinNT the html documentation built with javadoc I guess has the
following definition for File.list method:

String list()

Here is the html source I copied.

<pre>
  public <a href="java.lang.String.html#_top_">String</a> list()
</pre>

You see no brakets.

Happily it was stated beneth as a comment that it returns a array of Strings.
Looking at the source I found

String list()[]

This is why I say allow javadoc to use String list()[] in it's html
documentation or change source file into String[] list() and Javadoc handles
this correctly I think.
<pre>
  public <a href="java.lang.String.html#_top_">String</a> list()
</pre>


============================

>>2. File.list lacks simple File.list( String ) method where the String would
>>allow wild cards. Using FilenameFilter is a more general method but much
>>more havier to use for the most common usage of a file list command. It
>>would allow to do something like a File.list("*.java") call.
>
>You could do the Java community a favor and write an implementaiton of
>FilenameFilter that did, say, csh or ksh style globbing.  That would solve
>this problem most neatly.

Wouldn't it be much simpler in usage to have a simple File.list(String) ?
FilenameFilter looks havy and in my opinion usefull when applying to a more
complex selection method. And beside globbing as you call it is so frequent
and usefull. It looks like a basic command to me.

Beside that I have another question, if i ever write a piece of code I would
like to share, like this globbing flienameFilter class, where could I put it
so it gets available to the community ?

I just wrote a general class sorting class using qsort. It uses an interface
"Sortable" with a single method "smalerThan". And the Sorting class with a
static method qSort( Sortable[] ). I packaged them under cppm.sort. Where
cppm is, let say, my company name. 

============================
>>3. Where is the File.delete method ? We are unable to delete files. Did I
>>miss it ?
>
>Now that's a good question ...

Now that's a good answer...    ;-)

Seriously ?

============================

here is a list of the methods I miss in the File class

lastAccessStamp returns a time value of last access.
creationStamp   returns a time value of file creation.

type            returns a string specifying the file type.
                file, directory, characterSpecial, blockSpecial, fifo, link,
                sockets, ... Other types are implementation dependant.
nameHaid        returns a String containing all characters before the last dot.
                excluding the path.
nameTail        returns a String containing all characters after the last dot.
                returns an empty string if the name contains no dot.
getSize         return the file size
setSize(size)   shortens or extend the file length to the specified size. 
Bien cordialement,

Ch.Meessen

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post