java - Create temporary file on specific partition -


i want write contents file atomically. have deal variety of filesystems, don't support atomic writes or locks.

so want write changes temporary file first , move file target location, overwriting existing (old) file.

for move operation fast possible, want temporary file on same partition target file. don't want in target directory, might interfere 3rd party applications.

is there (cross-platform) way create temporary file (using nio) on specific partition? or way ensure move operation being fast make temporary file sibling of target file?

     // creates temporary file      f = file.createtempfile("tmp", ".txt", new file("c:/"));      // deletes file when virtual machine terminate      f.deleteonexit(); 

(1) can specify folder (partition) parameter 3 in createtempfile

(2) should put temp files in temp folder, need determine.

(3) can gain drive (partition) original file.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -