java - Atomically move and rename a Path instance - Stack Overflow If you need it to be atomic, you...

Please Visit: http://ift.tt/1ajReyV



java - Atomically move and rename a Path instance - Stack Overflow



If you need it to be atomic, you can use the ATOMIC_MOVE option:

import static java.nio.file.StandardCopyOption.ATOMIC_MOVE;

Files.move(path, targetPath, ATOMIC_MOVE);

Note that this can fail with an AtomicMoveNotSupportedException if the option is not supported (for example if you are moving a file from a local hard drive to a network location).

http://ift.tt/1hFEhUT

Done






from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1ApdhRG

via LifeLong Community

No comments:

Post a Comment