Creating File Descriptor

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

Listing 3-2 shows the content of the file:

Listing 3-2: The File
start example
 /* Imports the package class. */ import; /* 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
Year: 2004
Pages: 55 © 2008-2017.
If you may any questions please contact us: