java - What protocols does FileUtils.copyUrlToFile support? -
what protocols commons-io fileutils.copyurltofile allow copy from?
short answer: depends on jvm, @ least http
, https
, file
, , jar
work.
long answer: fileuils uses java's java.net.url
handle actual connection. java.net.url
uses protocol-specific instances of urlstreamhandler implement different protocol. handlers found dynamically, , can add own. according javadoc, guaranteed have http, https, file , jar handlers:
protocol handlers following protocols guaranteed exist on search path :-
http, https, file, , jar
handlers other protocols not guaranteed exist on every jvm. on windows x64 machine, uses java 8u111, under sun.net.www.protocol
see mailto
, ftp
, netdoc
handlers, means these protocols supported. note fact protocol supported, doesn't mean copyurltofile
makes sense (e.g. mailto)
Comments
Post a Comment