File.java uses a variable as:
private final transient int prefixLength;
And says, this is "abstract pathname's prefix".
File.java also have a constructor as:
public File(String pathname) {
if (pathname == null) {
throw new NullPointerException();
}
this.path = fs.normalize(pathname);
this.prefixLength = fs.prefixLength(this.path);
}
Here it is setting the variable prefixLength using fs.prefixLength() method.
Variable fs is defined in File.java as:
private static final FileSystem fs = DefaultFileSystem.getFileSystem();
Method getFileSystem() of DefaultFileSystem class returns object of UnixFileSystem. So method fs.prefixLength() actually calls prefixLength() method of UnixFileSystem. The prefixLength() method of UnixFileSystem is implemented as:
public int prefixLength(String pathname) {
if (pathname.length() == 0) return 0;
return (pathname.charAt(0) == '/') ? 1 : 0;
}
Means this method will only return 0 or 1 Depending upon the length of the pathname or first character of the pathname.
My doubt is: What type of length it is, and what is its significance?