Create file optional.

@param path  the path
@param attrs the attrs
@return the optional
489814
public static Optional<Path> createFile(Path path,
            FileAttribute<?>... attrs) {
        debug(log, "createFile", path, attrs);
        try {
            return Optional.of(Files.createFile(path, attrs));
        } catch (Exception e) {
            return JMExceptionManager.handleExceptionAndReturnEmptyOptional(log,
                    e, "createFile", path);
        }
    }
1064868
@Nonnull
  public File createDestinationFileForPath(@Nonnull final String path) {
    assertNotNull("Path is null", path);

    if (path.isEmpty()) {
      throw makeException("File name is empty", null);
    }

    return new File(this.getTarget(), path);
  }
621659
public static Optional<Path> createTempFilePathAsOpt(Path path) {
        debug(log, "createTempFilePathAsOpt", path);
        String[] prefixSuffix = JMFiles.getPrefixSuffix(path.toFile());
        try {
            return Optional
                    .of(Files.createTempFile(prefixSuffix[0], prefixSuffix[1]))
                    .filter(JMPath.ExistFilter)
                    .map(JMPathOperation::deleteOnExit);
        } catch (Exception e) {
            return JMExceptionManager.handleExceptionAndReturnEmptyOptional(log,
                    e, "createTempFilePathAsOpt", path);
        }
    }
753105
@Override
	protected InputStream openStream(String path) throws IOException {
		File file = new File(path);
		if (file.isFile() && file.canRead()) {
			return new FileInputStream(path);
		} else {
			return null;
		}
	}
206689
public SftpFile getFile(String path) throws SftpStatusException,
			SshException {
		String absolute = getAbsolutePath(path);
		SftpFile file = new SftpFile(absolute, getAttributes(absolute));
		file.sftp = this;
		return file;
	}
905860
private File createNewFile(String path) throws IOException {

		// In windows, pathnames with spaces are returned as %20
		if (path.contains("%20"))
			path = path.replaceAll("%20", " ");
		File newFile = new File(path);

		if (!newFile.exists() && !newFile.createNewFile()) {
			throw new BundlingProcessException("Unable to create a temporary file at " + path);
		}

		if (LOGGER.isDebugEnabled())
			LOGGER.debug("Created file: " + newFile.getCanonicalPath());
		return newFile;
	}
1279852
public SymbolicLink createSymbolicLink(
      JimfsPath path, JimfsPath target, FileAttribute<?>... attrs) throws IOException {
    if (!store.supportsFeature(Feature.SYMBOLIC_LINKS)) {
      throw new UnsupportedOperationException();
    }
    return (SymbolicLink) createFile(path, store.symbolicLinkCreator(target), true, attrs);
  }
1139202
function (path) {
		var attr = {
			fill: NONE
		};
		if (isArray(path)) {
			attr.d = path;
		} else if (isObject(path)) { // attributes
			extend(attr, path);
		}
		return this.createElement('path').attr(attr);
	}
382873
public static File file(String path) {
		if (StrUtil.isBlank(path)) {
			throw new NullPointerException("File path is blank!");
		}
		return new File(getAbsolutePath(path));
	}
130784
private File createTmpFile(final String path) throws IOException {
        getLog().debug("Creating temporary file for: " + path);
        final File output = new File(System.getProperty("java.io.tmpdir"), "ansible-maven-plugin." + System.nanoTime());
        final FileOutputStream outputStream = new FileOutputStream(output);
        final InputStream inputStream = getClass().getResourceAsStream("/" + path);
        if (inputStream == null){
            throw new FileNotFoundException("Unable to locate: " + path);
        }
        copy(inputStream, outputStream);
        return output;
    }
596365
def _get_requirement_attr(self, attr, path):
        
        for req_file in self.requirements:
            if path.strip("/") == req_file.path.strip("/"):
                return getattr(req_file, attr)
        return getattr(self, attr)
1293960
public static final Path create(Path path, Path target, String perms) throws IOException
    {
        FileAttribute<?>[] attrs = getFileAttributes(perms);
        switch (perms.charAt(0))
        {
            case '-':
                return Files.createFile(path, attrs);
            case 'l':
                if (target == null)
                {
                    throw new IllegalArgumentException("no target");
                }
                return Files.createSymbolicLink(path, target, attrs);
            case 'd':
                return Files.createDirectories(path, attrs);
            default:
                throw new IllegalArgumentException(perms+" illegal to this method");
        }
    }
1311824
@NotNull
    public static FileInfo forPath(Path path) {
        try {
            final BasicFileAttributes attributes = Files.readAttributes(path, BasicFileAttributes.class);
            return FileInfo.builder()
                    .path(path)
                    .key(attributes.fileKey())
                    .size(attributes.size())
                    .modificationTime(attributes.lastModifiedTime())
                    .build();
        } catch (Exception e) {
            LOG.error("Couldn't get file info for path: {}", path, e);
            return EMPTY_FILE_INFO.toBuilder().path(path).build();
        }
    }
533482
@Override
    public FileChannel newFileChannel(Path path, Set<? extends OpenOption> options,
            FileAttribute<?>... attrs) throws IOException {
        return new ShrinkWrapFileChannel(newByteChannel(path, options, attrs));
    }
144651
public static final void setShortAttribute(Path path, String attribute, short value, LinkOption... options) throws IOException
    {
        attribute = attribute.startsWith("user:") ? attribute : "user:"+attribute;
        Files.setAttribute(path, attribute, Primitives.writeShort(value), options);
    }
1358091
def SetFileAttributes(filepath, *attrs):
	
	nice_names = collections.defaultdict(
		lambda key: key,
		hidden='FILE_ATTRIBUTE_HIDDEN',
		read_only='FILE_ATTRIBUTE_READONLY',
	)
	flags = (getattr(api, nice_names[attr], attr) for attr in attrs)
	flags = functools.reduce(operator.or_, flags)
	handle_nonzero_success(api.SetFileAttributes(filepath, flags))
810602
public FSDataOutputStream createFSDataOutputStream(String path) throws IOException {
        return fs.create(new Path(path), false);
    }