• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
AbstractHttpEntity Class Referenceabstract

Abstract base class for entities. More...

Inheritance diagram for AbstractHttpEntity:
HttpEntity BasicHttpEntity ByteArrayEntity EntityTemplate FileEntity InputStreamEntity SerializableEntity StringEntity UrlEncodedFormEntity

Description

Provides the commonly used attributes for streamed and self-contained implementations of HttpEntity .

Author
Oleg Kalnichevski
Version
Revision
496070
Since
4.0

Notice

The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.

/*
 * Copyright (C) 2006 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Public Member Functions

Header getContentType ()
 Obtains the Content-Type header. More...
 
Header getContentEncoding ()
 Obtains the Content-Encoding header. More...
 
boolean isChunked ()
 Obtains the 'chunked' flag. More...
 
void setContentType (final Header contentType)
 Specifies the Content-Type header. More...
 
void setContentType (final String ctString)
 Specifies the Content-Type header, as a string. More...
 
void setContentEncoding (final Header contentEncoding)
 Specifies the Content-Encoding header. More...
 
void setContentEncoding (final String ceString)
 Specifies the Content-Encoding header, as a string. More...
 
void setChunked (boolean b)
 Specifies the 'chunked' flag. More...
 
void consumeContent () throws IOException, UnsupportedOperationException
 Does not consume anything. More...
 
- Public Member Functions inherited from HttpEntity
boolean isRepeatable ()
 Tells if the entity is capable to produce its data more than once. More...
 
long getContentLength ()
 Tells the length of the content, if known. More...
 
InputStream getContent () throws IOException, IllegalStateException
 Creates a new InputStream object of the entity. More...
 
void writeTo (OutputStream outstream) throws IOException
 Writes the entity content to the output stream. More...
 
boolean isStreaming ()
 Tells whether this entity depends on an underlying stream. More...
 

Protected Member Functions

 AbstractHttpEntity ()
 Protected default constructor. More...
 

Protected Attributes

Header contentType
 The Content-Type header. More...
 
Header contentEncoding
 The Content-Encoding header. More...
 
boolean chunked
 The 'chunked' flag. More...
 

Constructor & Destructor Documentation

◆ AbstractHttpEntity()

AbstractHttpEntity ( )
protected

The attributes of the created object remain null and false, respectively.

Member Function Documentation

◆ getContentType()

Header getContentType ( )

The default implementation returns the value of the contentType attribute.

Returns
the Content-Type header, or null

Implements HttpEntity.

◆ getContentEncoding()

Header getContentEncoding ( )

The default implementation returns the value of the contentEncoding attribute.

Returns
the Content-Encoding header, or null

Implements HttpEntity.

◆ isChunked()

boolean isChunked ( )

The default implementation returns the value of the chunked attribute.

Returns
the 'chunked' flag

Implements HttpEntity.

◆ setContentType() [1/2]

void setContentType ( final Header  contentType)

The default implementation sets the value of the contentType attribute.

Parameters
contentTypethe new Content-Encoding header, or null to unset

◆ setContentType() [2/2]

void setContentType ( final String  ctString)

The default implementation calls (Header) setContentType(Header) .

Parameters
ctStringthe new Content-Type header, or null to unset

◆ setContentEncoding() [1/2]

void setContentEncoding ( final Header  contentEncoding)

The default implementation sets the value of the contentEncoding attribute.

Parameters
contentEncodingthe new Content-Encoding header, or null to unset

◆ setContentEncoding() [2/2]

void setContentEncoding ( final String  ceString)

The default implementation calls (Header) setContentEncoding(Header) .

Parameters
ceStringthe new Content-Encoding header, or null to unset

◆ setChunked()

void setChunked ( boolean  b)

The default implementation sets the value of the chunked attribute.

Parameters
bthe new 'chunked' flag

◆ consumeContent()

void consumeContent ( ) throws IOException, UnsupportedOperationException

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

Exceptions
IOExceptionin case of an I/O problem
UnsupportedOperationExceptionif a streaming subclass does not override this method

Implements HttpEntity.

Reimplemented in BasicHttpEntity, InputStreamEntity, and EntityTemplate.

Member Data Documentation

◆ contentType

Header contentType
protected

Returned by getContentType , unless that method is overridden.

◆ contentEncoding

Header contentEncoding
protected

Returned by getContentEncoding , unless that method is overridden.

◆ chunked

boolean chunked
protected

Returned by isChunked , unless that method is overridden.