Java InstantCode. Developing Applications Using Java NIO
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
|
/* 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; } }
|
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.
Категории