-1

Hi I have to download a file from our svn server location. file url is like this- https://abc.xyz.com/svn/MyProject/trunk/documents/abc.docx to download. Please Help on how to download it. Thanks in Advance

1 Answers1

0

Simple : open a connection and copy the inputStream to the destination file outputStream :

public void downloadFile(String location, File destinationFile) throws IOException
{
    try (FileOutputStream fos = new FileOutputStream( destinationFile )){
        URL url = new URL(location);
        URLConnection connection = url.openConnection();
        IOUtils.copy( connection.getInputStream(),  fos);
    } 
}
Laurent B
  • 2,200
  • 19
  • 29