ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
isurl.m
Go to the documentation of this file.
1%> \brief
2%> Return a scalar MATLAB logical that is ``true`` if and
3%> only if the input URL string exists in the world wide web.<br>
4%>
5%> \param[in] url : The input scalar MATLAB string
6%> whose existence as a URL is to be tested.<br>
7%>
8%> \return
9%> ``itis`` : The output scalar MATLAB logical that is ``true`` if and
10%> only if the input URL string exists in the world wide web.<br>
11%>
12%> \interface{isurl}
13%> \code{.m}
14%>
15%> itis = pm.web.isurl(url)
16%>
17%> \endcode
18%>
19%> \example{isurl}
20%> \include{lineno} example/web/isurl/main.m
21%> \output{isurl}
22%> \include{lineno} example/web/isurl/main.out.m
23%>
24%> \final{isurl}
25%>
26%> \author
27%> \JoshuaOsborne, May 22 2024, 7:50 PM, University of Texas at Arlington<br>
28%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
29%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin<br>
30function itis = isurl(url)
31 itis = false;
32 try
33 urlobj = java.net.URL(url); %create the url object
34 %%%%
35 %%%% Get the proxy information using the MATLAB proxy API.
36 %%%%
37 proxy = com.mathworks.webproxy.WebproxyFactory.findProxyForURL(urlobj);
38 %%%%
39 %%%% Open a connection to the urlobj.
40 %%%%
41 if isempty(proxy)
42 urlConnection = urlobj.openConnection;
43 else
44 urlConnection = urlobj.openConnection(proxy);
45 end
46 %%%%
47 %%%% Try to start the input stream.
48 %%%%
49 inputStream = urlConnection.getInputStream;
50 itis = true;
51 end
52end
function isurl(in url)
Return a scalar MATLAB logical that is true if and only if the input URL string exists in the world w...