I'm downloading an file with Files.copy
method:
Files.copy(in, Paths.get(targetZipFile), StandardCopyOption.REPLACE_EXISTING)
If the download is slow i wish to cancel it.
I found the following topic on stackoverflow with the same title: How to cancel Files.copy() in Java?
But this solution uses a private api:
Access restriction: The type 'ExtendedCopyOption'
is not API (restriction on required library 'C:\Program Files\Java\jdk1.8.0_60\jre\lib\rt.jar'
)
Is there another way to cancel Files.copy()
?