Example #1
0
 static FileStateValue createWithStatNoFollow(
     RootedPath rootedPath,
     FileStatusWithDigest statNoFollow,
     @Nullable TimestampGranularityMonitor tsgm)
     throws InconsistentFilesystemException, IOException {
   Path path = rootedPath.asPath();
   if (statNoFollow.isFile()) {
     return statNoFollow.isSpecialFile()
         ? SpecialFileStateValue.fromStat(statNoFollow, tsgm)
         : RegularFileStateValue.fromPath(path, statNoFollow, tsgm);
   } else if (statNoFollow.isDirectory()) {
     return DIRECTORY_FILE_STATE_NODE;
   } else if (statNoFollow.isSymbolicLink()) {
     return new SymlinkFileStateValue(path.readSymbolicLinkUnchecked());
   }
   throw new InconsistentFilesystemException(
       "according to stat, existing path "
           + path
           + " is "
           + "neither a file nor directory nor symlink.");
 }