A question on File access

I have a program in C for Unix. I need a windows version of the program so I am writing it in Java.

Essentially what the program does is it takes in apath as command line input and reads every file in the path into a buffer. But there are a few things to take care of:

1) If there is a directory in the specified path then I should go ahead and read every file in that directory too (hence you can see this is a recursive operation)

2) if a file or a directory is a short cut, I want to make sure the file and directory is processed only once.

3) I need the logical and physical size of the file before reading the file.

The C program makes use of thestat() system call to get various statistics of the file such as: mode, inode number, number of links to the file, file size, atime, mtime, ctime, blocks...

mode: tells me if it is a directory, file or a symbolic link.

If it is a file, read it in a buffer.

If it is a directory, go ahead and do a stat() on every file in it.

if it is a symbolic link, do nothing.

inode number: If there is one file which is a hardlink to another, these two will have the same inode number. But I want to make sure I have read in the file only once. Thats where I make use of this inode number.

Other stats that I make use of is:

size: file size.

blocks: number of blocks occupied by the file (similar to size on disk)

Is there anything like stat() in Java, that I can use to get all this information of a file ?

Thanks !

[1596 byte] By [the_learner2a] at [2007-11-27 9:48:56]
# 1
http://java.sun.com/docs/books/tutorial/essential/io/fileio.html http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html
hunter9000a at 2007-7-13 0:17:33 > top of Java-index,Java Essentials,Java Programming...
# 2
> Is there anything like stat() in Java, that I can use> to get all this information of a file ?No, not that I know of.Kaj
kajbja at 2007-7-13 0:17:33 > top of Java-index,Java Essentials,Java Programming...