file isHidden Example
file class isHidden example. This example shows you how to use isHidden method.
File class isHidden example. method generates boolean results after checking the abstract pathname for a hidden type file.path is abstract as it is defined inside the system.method return type is boolean. In UNIX based system method looks for '.' dot operator for declaring a file as to be of hidden type.In microsoft a file is said to be hidden if it is marked as hidden.
Here is the code:-
/**
* @Program uses IsHidden method to check the abstract
* pathname for a hidden type file.
* IsHidden.java
* Author:-RoseIndia Team
* Date:-30-june-2008
*/
import java.io.*;
public class IsHidden {
public static void main(String args[]) throws IOException {
File fairy = new File("/home/mahendra/Desktop/.limca.txt"),
red_fairy = new File("/home/mahendra/Desktop/CompareTo.java~");
boolean v = fairy.isHidden(), c = red_fairy.isHidden();
System.out.println("'isHidden' file results");
System.out.println(".limca.txt is hidden: " + v + "\n"
+ "CompareTo.java~' is hidden: " + c);
}
} |
Output of the program:-
'isHidden' file results
.limca.txt is hidden: true
CompareTo.java~' is hidden: false |
|