Given a pathname, how can I tell whether the object is a directory or a file using the Java File API?
<p>Given the absolute path as a variable String pathname, how can I do the following using the Java Class File? The answers as far as I know are in parenthesis, please confirm.</p>

<ol>
<li><p>get the size of the file/directory? (I'm not sure)</p></li>
<li><p>test if the absolute path even leads to something that exists? (File.exists(pathname), which should return a boolean true if it exists, boolean false otherwise) </p></li>
<li><p>see if this is this a file or directory? (File.isFile(pathname), which returns a boolean true if the pathname leads to a file, false otherwise. file.isDirectory(pathname), which returns a boolean true if the pathname leads to a directory, false otherwise)</p></li>
<li><p>see the last date modified? (File.lastModified(pathname), which returns a long number which I already have the method for to convert to a specific date</p></li>
</ol>

<p>A related but separate question: is there something that is a "file", like a .doc, .jpeg, .mpeg, .mp3, .xml, .* that will fail both isFile and isDirectory tests? If so, how can I distinguish between an empty folder and a folder with a file that fails both isFile and isDirectory tests? I'm asking because on the File class documentation, it states the following for isFile: Tests whether the file denoted by this abstract pathname is a normal file. A file is normal if it is not a directory and, in addition, satisfies other system-dependent criteria. Any non-directory file created by a Java application is guaranteed to be a normal file.</p>
