org.apache.http.HttpEntity#isStreaming ( )源码实例Demo

下面列出了org.apache.http.HttpEntity#isStreaming ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: neembuu-uploader   文件: HttpUtil.java
private static ReadableByteChannel wrap(final InputStream is, final HttpEntity he,
        final Content c, final double contentLength){
    return new ReadableByteChannel() {
        double total = 0;
        @Override public int read(ByteBuffer dst) throws IOException {
            byte[]b=new byte[dst.capacity()];
            int r = is.read(b); 
            //this sleep is just to slow down update to see, if the UI is working or not !
            // NU's update is very very very fast
            //try{Thread.sleep(1000);}catch(Exception a){}
            dst.put(b,0,r); total+=r; c.setProgress(total/contentLength);
            return r;
        }
        @Override public boolean isOpen() {
            return he.isStreaming();
        }
        @Override public void close() throws IOException {
            is.close();
        }
    };
}
 
源代码2 项目: galaxy-fds-sdk-java   文件: FDSHttpClient.java
public void closeResponseEntity(HttpResponse response) {
  if (response == null)
    return;
  HttpEntity entity = response.getEntity();
  if (entity != null && entity.isStreaming())
    try {
      entity.getContent().close();
    } catch (IOException e) {
      LOG.error(formatErrorMsg("close response entity", e));
    }
}
 
源代码3 项目: bce-sdk-java   文件: BceHttpResponse.java
public BceHttpResponse(CloseableHttpResponse httpResponse) throws IOException {
    this.httpResponse = httpResponse;
    HttpEntity entity = httpResponse.getEntity();
    if (entity != null && entity.isStreaming()) {
        this.content = entity.getContent();
    }
}
 
源代码4 项目: galaxy-sdk-java   文件: SdsTHttpClient.java
/**
 * copy from org.apache.http.util.EntityUtils#consume. Android has it's own httpcore that doesn't
 * have a consume.
 */
private static void consume(final HttpEntity entity) throws IOException {
  if (entity == null) {
    return;
  }
  if (entity.isStreaming()) {
    InputStream instream = entity.getContent();
    if (instream != null) {
      instream.close();
    }
  }
}
 
源代码5 项目: galaxy-sdk-java   文件: GalaxyHttpClient.java
/**
 * copy from org.apache.http.util.EntityUtils#consume. Android has it's own httpcore that doesn't
 * have a consume.
 */
private static void consume(final HttpEntity entity) throws IOException {
  if (entity == null) {
    return;
  }
  if (entity.isStreaming()) {
    InputStream instream = entity.getContent();
    if (instream != null) {
      instream.close();
    }
  }
}
 
源代码6 项目: galaxy-sdk-java   文件: BaseClient.java
protected static void closeResponseEntity(HttpResponse response) {
  if (response == null)
    return;
  HttpEntity entity = response.getEntity();
  if (entity != null && entity.isStreaming())
    try {
      entity.getContent().close();
    } catch (IOException e) {
      LOG.error("close response entity", e);
    }
}
 
源代码7 项目: galaxy-sdk-java   文件: MetricsHttpClient.java
/**
 * copy from org.apache.http.util.EntityUtils#consume. Android has it's own httpcore that doesn't
 * have a consume.
 */
private static void consume(final HttpEntity entity) throws IOException {
  if (entity == null) {
    return;
  }
  if (entity.isStreaming()) {
    InputStream instream = entity.getContent();
    if (instream != null) {
      instream.close();
    }
  }
}
 
源代码8 项目: galaxy-sdk-java   文件: TalosHttpClient.java
/**
 * copy from org.apache.http.util.EntityUtils#consume. Android has it's own httpcore that doesn't
 * have a consume.
 */
private static void consume(final HttpEntity entity) throws IOException {
  if (entity == null) {
    return;
  }
  if (entity.isStreaming()) {
    InputStream instream = entity.getContent();
    if (instream != null) {
      instream.close();
    }
  }
}
 
源代码9 项目: galaxy-sdk-java   文件: THttpClient.java
/**
 * copy from org.apache.http.util.EntityUtils#consume. Android has it's own httpcore
 * that doesn't have a consume.
 */
private static void consume(final HttpEntity entity) throws IOException {
    if (entity == null) {
        return;
    }
    if (entity.isStreaming()) {
        InputStream instream = entity.getContent();
        if (instream != null) {
            instream.close();
        }
    }
}
 
源代码10 项目: RoboZombie   文件: EntityUtils.java
/**
 * Ensures that the entity content is fully consumed and the content stream, if exists,
 * is closed.
 *
 * @param entity
 * @throws IOException if an error occurs reading the input stream
 *
 * @since 4.1
 */
public static void consume(final HttpEntity entity) throws IOException {
    if (entity == null) {
        return;
    }
    if (entity.isStreaming()) {
        InputStream instream = entity.getContent();
        if (instream != null) {
            instream.close();
        }
    }
}