23.07.2013 Views

Java IO.pdf - Nguyen Dang Binh

Java IO.pdf - Nguyen Dang Binh

Java IO.pdf - Nguyen Dang Binh

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Java</strong> I/O<br />

Windows NT supports multiple kinds of filesystems, including FAT (the basic DOScompatible<br />

filesystem) and NTFS (NT File System). NT 3.5.1 and earlier (but not NT 4.0 and<br />

later) support OS/2's HPFS. Each of these filesystems supports a slightly different set of<br />

attributes. They all support a superset of the basic DOS/Windows file attributes, including<br />

creation time, modification time, access time, allocation size, file size, and whether the file is<br />

read-only, system, hidden, archive, or control.<br />

On Unix, file attributes may be viewed by using the -l switch to the ls command:<br />

% ls -l<br />

total 3408<br />

-r--r--r-- 1 root other 89795 Aug 30 14:41 CHANGES<br />

-r--r--r-- 1 root other 896 Aug 30 14:41 COPYRIGHT<br />

-r--r--r-- 1 root other 5994 Aug 30 14:41 LICENSE<br />

-r--r--r-- 1 root other 34689 Aug 30 14:41 README<br />

drwxr-xr-x 3 root other 512 Oct 17 10:31 bin<br />

drwxr-xr-x 24 root other 512 Oct 16 21:07 demo<br />

drwxr-xr-x 4 root other 1024 Oct 17 10:31 include<br />

-r--r--r-- 1 root other 2497 Aug 30 14:41 index.html<br />

drwxr-xr-x 4 root other 1024 Oct 17 10:32 lib<br />

-rw-r--r-- 1 root other 1593763 Aug 30 14:40 src.zip<br />

The first column is a series of character flags indicating, respectively, the type of the file; the<br />

owner's read, write, and execute permissions; the group's read, write and execute permissions;<br />

and the world's read, write, and execute permissions. The number following that is the<br />

number of links to this file. The next word, root in all these cases, is the username of the<br />

owner of the file. The second word, other in this example, is the group associated with the<br />

file. The following number is the size of the file in bytes. This is followed by the last<br />

modification date of the file. The last column contains the name of the file itself.<br />

The attributes of a Windows file may be viewed from a DOS window with the DIR command:<br />

C:> DIR/X<br />

Volume in drive C has no label.<br />

Volume Serial Number is 9460-4CAA<br />

Directory of C:\<br />

12/31/96 04:03p 0 AUTOEXEC.BAT<br />

12/31/96 04:03p 0 CONFIG.SYS<br />

12/31/96 04:48p MSOffice<br />

11/12/97 11:28a 45,088,768 pagefile.sys<br />

11/05/97 08:13p Pro18<br />

12/31/96 03:54p PROGRA~1 Program Files<br />

12/31/96 04:03p TEMP<br />

11/12/97 11:29a WINNT<br />

8 File(s) 45,088,768 bytes<br />

640,570,880 bytes free<br />

This shows the file's name, optionally its short name, the size of the file in bytes (if it's not a<br />

directory), and the date and time when the file was created. With the /T:A or /T:W flags, you<br />

would see the time the file was last accessed or written (modified), respectively. DOS won't<br />

show you the archive, hidden, system, or read-only flags directly, but by using the /A:A,<br />

/A:H, /A:S, or /A:R flags, you can list only those files that have the specified attributes. By<br />

270

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!