Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
package Benchmark;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.nio.charset.Charset;
import org.json.JSONArray;
import org.json.JSONObject;
public class PVDetails {
public static JSONObject getPVDetails(String archapplDomain, String pvName, String query) throws IOException {
String url = "http://" + archapplDomain + ":17665/mgmt/bpl/getPVDetails?pv=" + pvName;
InputStream is = new URL(url).openStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
StringBuilder sb = new StringBuilder();
String inputLine;
while ((inputLine = rd.readLine()) != null) {
sb.append(inputLine);
}
String jsonString = sb.toString();
JSONArray jsonArray = new JSONArray(jsonString);
is.close();
JSONObject jo = null;
for (Object o : jsonArray) {
jo = (JSONObject) o;
if ( jo.get("name").toString().equals(query) ) {
break;
}
}
return jo;
}
}