private void atomicSaveFile(InputStream is, String fullPath, long fileSize, 
                                long lastModifiedTime, boolean isDir, TextProcessor textProcessor) throws Exception {
        DropboxFileUtil util = new DropboxFileUtil(this.rootDirAddr);
        String relativePath = util.getFileRelativePath(new File(fullPath));
        String fileCopyFullPath = this.tempDirPath+DropboxConstants.COPYFILE_DIR_MARK+relativePath;
        byte message = this.saveFile(is, fileCopyFullPath, fileSize, lastModifiedTime, isDir, fullPath, textProcessor);

        File fileCopy = new File(fileCopyFullPath);
        File file = new File(fullPath);

        if(message != DropboxConstants.NO_FILE_OPERATION && message != DropboxConstants.FILE_OPERATION_FAIL) {

            if(!file.exists()) {
                if(isDir)
                    file.mkdirs();
                else {
                    // get it's parent's dir path
                    // ex: file fullpath: /home/chengren/1/2/3/4/5.txt (it's a non-existing file, and dir 1,2,3,4 do not exist either)
                    // file.createNewFile() will report error is some dirs in the file path does not exist,
                    // so here we need its parentDirPath : /home/chengren/1/2/3/4
                    // then use mkdir to create this dir
                   String parentDirPath = fullPath.substring(0, fullPath.lastIndexOf(System.getProperty("file.separator")));
                   File parentDir = new File(parentDirPath);
                   parentDir.mkdirs();
                   file.createNewFile();
                }
            }
            
            // rename to is the only file move operation provided by java.io.file
            boolean isRenameSucceed = fileCopy.renameTo(file);
            // ensure that after the renaming, the modified would not change
            file.setLastModified(lastModifiedTime);
            System.out.println("file src is dir? "+fileCopy.isDirectory());
            if(!isRenameSucceed) {
                System.out.println("File Copy "+ fileCopyFullPath +" Exists ? " + fileCopy.exists());
                System.out.println("rename fails: " + "src file :" + fileCopyFullPath + " dest file : "+ fullPath);
            }
            else
                DropboxMessageConsole.printMessage(message, fullPath);
        }
    }