java read from connection even if 404
HttpURLConnection c = (HttpURLConnection)new URL("http://somesite.com").openConnection();
InputStream in = null;
if (c.getResponseCode() >= 400) {
in = c.getErrorStream();
}
else {
in = c.getInputStream();
}
Also in Java:
- how do I change the opacity of a JButton
- java exponencial
- remove item from arraylist in java
- how to close a jframe in java with an if statement
- float to string java
- How tomake teris in Java
- how to open a folder in java swing project
- how to use for loop for array in java
- java map declaration
- How to draw Bezier Curve in Android
- how to add an object to a list of objects in java
- how to print to console in java
- java for increment by 2
- java jpa criteriabuilder in xample
- waht does&& mean in java
- java convert edittext to double
- partial view tiles spring
- string replace last character java
- Method used for getting metadata of a database in jdbc
- char array to string java
- log4j with spring boot restful services
- Java array hashcode
- string to double java exception
- unity how to make a gameobject slowly look at a position