本文整理汇总了Java中java.net.ProtocolException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java ProtocolException.printStackTrace方法的具体用法?Java ProtocolException.printStackTrace怎么用?Java ProtocolException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.net.ProtocolException
的用法示例。
在下文中一共展示了ProtocolException.printStackTrace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setRequestMethod
import java.net.ProtocolException; //导入方法依赖的package包/类
/**
* Change le type de la requête HTTP
*
* @param method Le nom du type de la requête HTTP
*/
protected void setRequestMethod(String method) {
try {
_httpURLConnection.setRequestMethod(method);
} catch (ProtocolException e) {
e.printStackTrace();
}
}
示例2: setRequestMethod
import java.net.ProtocolException; //导入方法依赖的package包/类
@Deprecated
public HttpObservable setRequestMethod(String method) {
try {
mConnection.setRequestMethod(method);
this.method = method;
} catch (ProtocolException e) {
log.e("Illegal request method");
e.printStackTrace();
}
return this;
}
示例3: a
import java.net.ProtocolException; //导入方法依赖的package包/类
protected byte[] a(String... strArr) {
try {
try {
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(strArr[0]).openConnection();
httpURLConnection.setConnectTimeout(5000);
try {
httpURLConnection.setRequestMethod("GET");
try {
InputStream inputStream = httpURLConnection.getInputStream();
try {
if (httpURLConnection.getResponseCode() == 200) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byte[] bArr = new byte[1024];
while (true) {
int read = inputStream.read(bArr);
if (read != -1) {
byteArrayOutputStream.write(bArr, 0, read);
} else {
byteArrayOutputStream.close();
inputStream.close();
return byteArrayOutputStream.toByteArray();
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
return null;
} catch (IOException e2) {
e2.printStackTrace();
return null;
}
} catch (ProtocolException e3) {
e3.printStackTrace();
return null;
}
} catch (IOException e22) {
e22.printStackTrace();
return null;
}
} catch (MalformedURLException e4) {
e4.printStackTrace();
return null;
}
}