use of org.structr.dynamic.File in project structr by structr.
the class FileNodeDataContainer method persistTemporaryFile.
/**
* Renames / moves the temporary file to its final location. This method is called when the cloud service recevies a <code>FileNodeEndChunk</code>.
*
* @param finalPath the final path of this file
* @return whether the renaming/moving was successful
*/
public boolean persistTemporaryFile(String finalPath) throws IOException {
boolean ret = false;
if (temporaryFile != null) {
final java.io.File finalFile = new java.io.File(finalPath);
final Path source = temporaryFile.toPath();
final Path dest = finalFile.toPath();
// create parent directories
finalFile.mkdirs();
// move file from tmp to final destination
Files.move(source, dest, StandardCopyOption.REPLACE_EXISTING);
}
return (ret);
}
Aggregations