public File getRawFile ( Object projectIdOrPath , String commitOrBranchName , String filepath , File directory ) throws GitLabApiException { InputStream in = getRawFile ( projectIdOrPath , commitOrBranchName , filepath ) ; try { if ( directory == null ) { directory = new File ( System . getProperty ( "java.io.tmpdir" ) ) ; } String filename = new File ( filepath ) . getName ( ) ; File file = new File ( directory , filename ) ; Files . copy ( in , file . toPath ( ) , StandardCopyOption . REPLACE_EXISTING ) ; return ( file ) ; } catch ( IOException ioe ) { throw new GitLabApiException ( ioe ) ; } finally { try { in . close ( ) ; } catch ( IOException ignore ) { } } }
Get the raw file for the file by commit sha and path . Thye file will be saved to the specified directory . If the file already exists in the directory it will be overwritten .