Android
org.apache.http.entity
public class

org.apache.http.entity.BasicHttpEntity

java.lang.Object
org.apache.http.entity.AbstractHttpEntity HttpEntity
org.apache.http.entity.BasicHttpEntity

A generic streamed entity being received on a connection.

Summary

Fields inherited from class org.apache.http.entity.AbstractHttpEntity

Public Constructors

            BasicHttpEntity()
Creates a new basic entity.

Public Methods

          void  consumeContent()
Does not consume anything.
          InputStream  getContent()
Obtains the content, once only.
          long  getContentLength()
          boolean  isRepeatable()
Tells that this entity is not repeatable.
          boolean  isStreaming()
          void  setContent(InputStream instream)
Specifies the content.
          void  setContentLength(long len)
Specifies the length of the content.
          void  writeTo(OutputStream outstream)
Methods inherited from class org.apache.http.entity.AbstractHttpEntity
Methods inherited from class java.lang.Object
Methods inherited from interface org.apache.http.HttpEntity

Details

Public Constructors

public BasicHttpEntity()

Creates a new basic entity. The content is initially missing, the content length is set to a negative number.

Public Methods

public void consumeContent()

Does not consume anything. The default implementation does nothing if isStreaming returns false, and throws an exception if it returns true. This removes the burden of implementing an empty method for non-streaming entities.

Throws

IOException

public InputStream getContent()

Obtains the content, once only.

Returns

  • the content, if this is the first call to this method since setContent has been called

Throws

IllegalStateException if the content has been obtained before, or has not yet been provided

public long getContentLength()

public boolean isRepeatable()

Tells that this entity is not repeatable.

Returns

  • false

public boolean isStreaming()

public void setContent(InputStream instream)

Specifies the content.

Parameters

instream the stream to return with the next call to getContent

public void setContentLength(long len)

Specifies the length of the content.

Parameters

len the number of bytes in the content, or a negative number to indicate an unknown length

public void writeTo(OutputStream outstream)

Throws

IOException
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:48