I've got a related question on this question.
The following excerpt is from here: https://docs.oracle.com/javase/7/docs/a ... CopyOption...)
public static long copy(InputStream in, Path target, CopyOption... options) throws IOException
Copies all bytes from an input stream to a file. On return, the input stream will be at end of stream.
By default, the copy fails if the target file already exists or is a symbolic link. If the REPLACE_EXISTING option is specified, and the target file already exists, then it is replaced if it is not a non-empty directory. If the target file exists and is a symbolic link, then the symbolic link is replaced. In this release, the REPLACE_EXISTING option is the only option required to be supported by this method. Additional options may be supported in future releases.
Based on this quote, the parameter "Path target" in the above copy method can be a file as well as a folder.If the REPLACE_EXISTING option is specified, and the target file already exists, then it is replaced if it is not a non-empty directory.
Is that correct?
If it is indeed a folder, then the folder must be empty before the copy with REPLACE_EXISTING can take place successfully.
Is that true?
Thanks.