public DbxEntry . /*@Nullable*/ File restoreFile ( String path , String rev ) throws DbxException { DbxPathV1 . checkArgNonRoot ( "path" , path ) ; if ( rev == null ) throw new IllegalArgumentException ( "'rev' can't be null" ) ; if ( rev . length ( ) == 0 ) throw new IllegalArgumentException ( "'rev' can't be empty" ) ; String apiPath = "1/restore/auto" + path ; /*@Nullable*/ String [ ] params = { "rev" , rev , } ; return doGet ( host . getApi ( ) , apiPath , params , null , new DbxRequestUtil . ResponseHandler < DbxEntry . /*@Nullable*/ File > ( ) { public DbxEntry . /*@Nullable*/ File handle ( HttpRequestor . Response response ) throws DbxException { if ( response . getStatusCode ( ) == 404 ) return null ; if ( response . getStatusCode ( ) != 200 ) throw DbxRequestUtil . unexpectedStatus ( response ) ; return DbxRequestUtil . readJsonFromResponse ( DbxEntry . File . Reader , response ) ; } } ) ; }
Takes a copy of the file at the given revision and saves it over the current latest copy . This will create a new revision but the file contents will match the revision you specified .