Code example for Path

Methods: getParent

0
      throws IOException
  { 
    checkNotNull(file);
    checkNotNull(charset);
    checkNotNull(payload);
    DirSupport.mkdir(file.getParent());
    try (final BufferedWriter writer = Files.newBufferedWriter(file, charset)) {
      writer.write(payload);
      writer.flush();
    } 
  } 
 
  // Validation 
 
  /** 
   * Enforces that passed in paths are non-null and denote an existing regular file. 
   */ 
  private static void validateFile(final Path... paths) {
    for (Path path : paths) {
      checkNotNull(path, "Path must be non-null");