本文整理汇总了Java中org.apache.http.conn.EofSensorInputStream类的典型用法代码示例。如果您正苦于以下问题:Java EofSensorInputStream类的具体用法?Java EofSensorInputStream怎么用?Java EofSensorInputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EofSensorInputStream类属于org.apache.http.conn包,在下文中一共展示了EofSensorInputStream类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: storeResponse
import org.apache.http.conn.EofSensorInputStream; //导入依赖的package包/类
@Override
protected void storeResponse(HttpResponse response, ICommRestResponse restResponse) throws Exception{
try{
// deconstruct the response entity
HttpEntity entity = response.getEntity();
// debug
System.out.println(entity.getContentType());
System.out.println(entity.getContentLength());
LogHelper.w("RestRequest-Response", "content length %d", entity.getContentLength());
System.out.println(EntityUtils.getContentCharSet(entity));
// get input stream
org.apache.http.conn.EofSensorInputStream inputStream = (EofSensorInputStream) entity.getContent();
// get image from input stream
Bitmap image = BitmapFactory.decodeStream(inputStream);
// add to response
ICommRestResponse<Bitmap> streamResponse = restResponse;
streamResponse.setResponseContent(image);
// set success
restResponse.setResponseCode( (long) (image == null ? 999 : 0));
}catch(Exception ex){
restResponse.setErrorMessage(ex.getMessage());
restResponse.setResponseCode((long) 999);
}
}
开发者ID:paulshemmings,项目名称:pico,代码行数:25,代码来源:BitmapJsonRestHandler.java
示例2: shouldCallAbortAndCloseOnConnectionReleaseTrigger
import org.apache.http.conn.EofSensorInputStream; //导入依赖的package包/类
@Test
public void shouldCallAbortAndCloseOnConnectionReleaseTrigger() throws IOException {
EofSensorInputStream stream = mock(EofSensorInputStream.class);
ClientHttpResponse response = mock(ClientHttpResponse.class);
when(response.getBody()).thenReturn(stream);
try (RestAsyncClientHttpResponse unit = new RestAsyncClientHttpResponse(response)) {
unit.getBody().close();
}
verify(stream).abortConnection();
verify(stream).close();
}
开发者ID:zalando,项目名称:riptide,代码行数:14,代码来源:RestAsyncClientHttpResponseBodyTest.java
示例3: storeResponse
import org.apache.http.conn.EofSensorInputStream; //导入依赖的package包/类
@Override
protected void storeResponse(HttpResponse response, ICommRestResponse restResponse) throws Exception{
// deconstruct the response entity
HttpEntity entity = response.getEntity();
// debug
System.out.println(entity.getContentType());
System.out.println(entity.getContentLength());
System.out.println(EntityUtils.getContentCharSet(entity));
// get input stream
org.apache.http.conn.EofSensorInputStream inputStream = (EofSensorInputStream) entity.getContent();
// add to response
ICommRestResponse<InputStream> streamResponse = restResponse;
streamResponse.setResponseContent(inputStream);
}
开发者ID:paulshemmings,项目名称:pico,代码行数:16,代码来源:StreamingJsonRestHandler.java
示例4: getContent
import org.apache.http.conn.EofSensorInputStream; //导入依赖的package包/类
@Override
public InputStream getContent() throws IOException {
return new EofSensorInputStream(this.wrappedEntity.getContent(), this);
}
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:5,代码来源:ResponseEntityProxy.java
注:本文中的org.apache.http.conn.EofSensorInputStream类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论