code: public static final void checkFileType(Path path, String perms)
      {
          if (perms.length() != 10)
          {
              throw new IllegalArgumentException(perms+" not permission. E.g. -rwxr--r--");
          }
          switch (perms.charAt(0))
          {
              case '-':
                  if (!Files.isRegularFile(path))
                  {
                      throw new IllegalArgumentException("file is not regular file");
                  }
                  break;
              case 'd':
                  if (!Files.isDirectory(path))
                  {
                      throw new IllegalArgumentException("file is not directory");
                  }
                  break;
              case 'l':
                  if (!Files.isSymbolicLink(path))
                  {
                      throw new IllegalArgumentException("file is not symbolic link");
                  }
                  break;
              default:
                  throw new UnsupportedOperationException(perms+" not supported");
          }
      }
docs: Throws IllegalArgumentException if perms length != 10 or files type doesn't
  match with permission.
  @param path
  @param perms