HttpEntity isStreaming - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for HttpEntity isStreaming method.

This code example shows how to use the following methods:isStreaming
 
	/* (non-Javadoc) 
	 * @see org.apache.http.HttpEntity#isStreaming() 
	 */ 
	public boolean isStreaming() { 
		return entity.isStreaming();
	} 
 
	/* (non-Javadoc) 
	 * @see org.apache.http.HttpEntity#writeTo(java.io.OutputStream) 
	 */ 
	public void writeTo(OutputStream os) throws IOException {
		entity.writeTo(new OutputStreamWrapper(os, callback));
		 
	} 
	 
} 
6
CodeRank
This code example shows how to use the following methods:getContent, isStreaming
        final ReadableByteChannel local = this.channel;
        this.channel = null;
        if (local != null) {
            local.close();
        } 
        if (this.entity.isStreaming()) {
            final InputStream instream = this.entity.getContent();
            instream.close();
        } 
    } 
 
} 
5
CodeRank
This code example shows how to use the following methods:isStreaming
    } 
 
 
    // non-javadoc, see interface HttpEntity 
    public boolean isStreaming() { 
        return (buffer == null) && wrappedEntity.isStreaming();
    } 
     
} // class BufferedHttpEntity 
5
CodeRank
This code example shows how to use the following methods:isStreaming
    } 
 
    @Test 
    public void testReusableEntityWriteToIOError() throws Exception { 
        final OutputStream outstream = Mockito.mock(OutputStream.class);
        Mockito.when(entity.isStreaming()).thenReturn(true);
        Mockito.when(connHolder.isReusable()).thenReturn(true);
        Mockito.doThrow(new IOException()).when(entity).writeTo(outstream);
        try { 
            wrapper.writeTo(outstream);
            Assert.fail("IOException expected");
        } catch (final IOException ex) {
        } 
        Mockito.verify(connHolder, Mockito.never()).releaseConnection();
        Mockito.verify(connHolder).abortConnection();
    } 
 
    @Test 
    public void testReusableEntityEndOfStream() throws Exception { 
        Mockito.when(instream.read()).thenReturn(-1);
4
CodeRank
This code example shows how to use the following methods:isStreaming
            final ConnectionHolder connHolder) {
        super(); 
        this.original = original;
        this.connHolder = connHolder;
        final HttpEntity entity = original.getEntity();
        if (entity != null && entity.isStreaming() && connHolder != null) {
            this.original.setEntity(new ResponseEntityWrapper(entity, connHolder));
        } 
    } 
 
    public void close() throws IOException { 
        if (this.connHolder != null) {
            this.connHolder.abortConnection();
        } 
    } 
 
    public Object invoke(
            final Object proxy, final Method method, final Object[] args) throws Throwable {
        if (method.equals(CLOSE_METHOD)) {
            close(); 
4
CodeRank
This code example shows how to use the following methods:getContent, isStreaming
	 
	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();
            } 
        } 
    } 
} 
4
CodeRank
This code example shows how to use the following methods:getContent, isStreaming
    } 
 
    abstract InputStream decorate(final InputStream wrapped) throws IOException;
 
    private InputStream getDecompressingStream() throws IOException {
        final InputStream in = wrappedEntity.getContent();
        try { 
            return decorate(in);
        } catch (final IOException ex) {
            in.close();
            throw ex;
        } 
    } 
 
    /** 
     * {@inheritDoc} 
     */ 
    @Override 
    public InputStream getContent() throws IOException {
        if (wrappedEntity.isStreaming()) {

4
CodeRank

Related HttpEntity isStreaming Questions & Answers:

isStreaming Method Overview
Tells whether this entity depends on an underlying stream.
See Code Examples for other Android HttpEntity Methods: