Creating File Descriptor


The FileInfo.java file creates a file descriptor class that stores the description of a particular file.

Listing 3-2 shows the content of the FileInfo.java file:

Listing 3-2: The FileInfo.java File
start example
 /* Imports the java.io package class. */ import java.io.Serializable; /* class FileInfo - This class stores the file description, such as file index, file name, and file size. Fields: fileIndex - Contains the file name. fileName - Contains the file path. fileSize - Contains the file size. */ public class FileInfo implements Serializable {    /* Declares the objects of String class. */    String fileIndex;    String fileName;    String fileSize;    /* Defines default constructors. */    public FileInfo(String fileIndex, String fileName, String fileSize)    {       this.fileIndex = fileIndex;       this.fileName = fileName;       this.fileSize = fileSize;    } } 
end example
 

Download this Listing .

In the above code, the FileInfo() constructor creates the file descriptor class. The fileName, filePath, and fileSize strings contain the file name, file location, and file size, respectively.




Java InstantCode. Developing Applications Using Java NIO
Java InstantCode. Developing Applications Using Java NIO
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 55

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net