private byte saveFile(InputStream is, String fullPath, long fileSize,
                          long lastModifiedTime, boolean isDir, String realFileFullPath,
                          TextProcessor textProcessor) throws Exception {
        byte message = DropboxConstants.NO_FILE_OPERATION;
        try {            
            String filePath = fullPath.substring(0, fullPath.lastIndexOf(System.getProperty("file.separator")));
            File copyFileDir = new File(filePath);
            File copyFileObj = new File(fullPath);
            File realFileObj = new File(realFileFullPath);
            
            if (isDir && !realFileObj.exists()) { // if this is an empty file dir and does not exist in this side
                copyFileObj.mkdirs();
                copyFileObj.setLastModified(lastModifiedTime);
                message = DropboxConstants.ADD_DIR;
            }
            else {
                // copyFileDir is 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 it's parentDirPath : /home/chengren/1/2/3/4
                // then use mkdir to create this dir.
                copyFileDir.mkdirs();
                copyFileDir.setLastModified(lastModifiedTime);
            }

            if(!isDir) {
                if (!realFileObj.exists()) {
                    message = DropboxConstants.ADD_FILE;
                    copyFileObj.createNewFile();
                    this.saveStreamDataToDiskFile(lastModifiedTime, fileSize, copyFileObj, textProcessor);
                }
                else if (realFileObj.lastModified() != lastModifiedTime) {
                    message = DropboxConstants.UPDATE_FILE;          
                    this.saveStreamDataToDiskFile(lastModifiedTime, fileSize, copyFileObj, textProcessor);
                }
                else {
                    is.skip(fileSize);
                }
            }
            else {
                is.skip(fileSize);
            }
        }
        catch (IOException ex) {
            message = DropboxConstants.FILE_OPERATION_FAIL;
            Logger.getLogger(DropboxFileTransferProtocolDeserializer.class.getName()).log(Level.SEVERE, null, ex);
        }

        return message;
    }