Java Doc for HttpEntity.java in  » Net » httpcomponents-core-4.0-beta1 » org » apache » http » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » httpcomponents core 4.0 beta1 » org.apache.http 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.http.HttpEntity

All known Subclasses:   org.apache.http.entity.HttpEntityWrapper,  org.apache.http.entity.AbstractHttpEntity,
HttpEntity
public interface HttpEntity (Code)
An entity that can be sent or received with an HTTP message. Entities can be found in some HttpEntityEnclosingRequest requests and in HttpResponse responses , where they are optional.

In some places, the JavaDoc distinguishes three kinds of entities, depending on where their HttpEntity.getContent content originates:

  • streamed: The content is received from a stream, or generated on the fly. In particular, this category includes entities being received from a HttpConnection connection . HttpEntity.isStreaming Streamed entities are generally not HttpEntity.isRepeatable repeatable .
  • self-contained: The content is in memory or obtained by means that are independent from a connection or other entity. Self-contained entities are generally HttpEntity.isRepeatable repeatable .
  • wrapping: The content is obtained from another entity.
This distinction is important for connection management with incoming entities. For entities that are created by an application and only sent using the HTTP components framework, the difference between streamed and self-contained is of little importance. In that case, it is suggested to consider non-repeatable entities as streamed, and those that are repeatable (without a huge effort) as self-contained.
author:
   Oleg Kalnichevski
version:
   $Revision: 496070 $
since:
   4.0




Method Summary
 voidconsumeContent()
     Consumes the remaining content of a streamed entity. This method is called to indicate that the content of this entity is no longer required. Streamed entities should dispose of the remaining content, if any. Self-contained entities can release allocated resources, but are not required to do anything. Wrapping entities should delegate this call to the wrapped entity.
This method is of particular importance for entities being received from a HttpConnection connection .
 InputStreamgetContent()
     Creates a new InputStream object of the entity.
 HeadergetContentEncoding()
     Obtains the Content-Encoding header, if known.
 longgetContentLength()
     Tells the length of the content, if known. the number of bytes of the content, ora negative number if unknown.
 HeadergetContentType()
     Obtains the Content-Type header, if known. This is the header that should be used when sending the entity, or the one that was received with the entity.
 booleanisChunked()
     Tells about chunked encoding for this entity.
 booleanisRepeatable()
     Tells if the entity is capable to produce its data more than once.
 booleanisStreaming()
     Tells whether this entity depends on an underlying stream.
 voidwriteTo(OutputStream outstream)
     Writes the entity content to the output stream.



Method Detail
consumeContent
void consumeContent() throws IOException(Code)
Consumes the remaining content of a streamed entity. This method is called to indicate that the content of this entity is no longer required. Streamed entities should dispose of the remaining content, if any. Self-contained entities can release allocated resources, but are not required to do anything. Wrapping entities should delegate this call to the wrapped entity.
This method is of particular importance for entities being received from a HttpConnection connection . The entity needs to be consumed completely in order to re-use the connection with keep-alive.
throws:
  IOException - if an I/O error occurs.This indicates that connection keep-alive is not possible.



getContent
InputStream getContent() throws IOException, IllegalStateException(Code)
Creates a new InputStream object of the entity. It is a programming error to return the same InputStream object more than once. Entities that are not HttpEntity.isRepeatable repeatable will throw an exception if this method is called multiple times. a new input stream that returns the entity data.
throws:
  IOException - if the stream could not be created
throws:
  IllegalStateException - if this entity is not repeatable and the streamhas already been obtained previously



getContentEncoding
Header getContentEncoding()(Code)
Obtains the Content-Encoding header, if known. This is the header that should be used when sending the entity, or the one that was received with the entity. Wrapping entities that modify the content encoding should adjust this header accordingly. the Content-Encoding header for this entity, ornull if the content encoding is unknown



getContentLength
long getContentLength()(Code)
Tells the length of the content, if known. the number of bytes of the content, ora negative number if unknown. If the content length is knownbut exceeds java.lang.Long.MAX_VALUE Long.MAX_VALUE,a negative number is returned.



getContentType
Header getContentType()(Code)
Obtains the Content-Type header, if known. This is the header that should be used when sending the entity, or the one that was received with the entity. It can include a charset attribute. the Content-Type header for this entity, ornull if the content type is unknown



isChunked
boolean isChunked()(Code)
Tells about chunked encoding for this entity. The primary purpose of this method is to indicate whether chunked encoding should be used when the entity is sent. For entities that are received, it can also indicate whether the entity was received with chunked encoding.
The behavior of wrapping entities is implementation dependent, but should respect the primary purpose. true if chunked encoding is preferred for thisentity, or false if it is not



isRepeatable
boolean isRepeatable()(Code)
Tells if the entity is capable to produce its data more than once. A repeatable entity's getContent() and writeTo(OutputStream) methods can be called more than once whereas a non-repeatable entity's can not. true if the entity is repeatable, false otherwise.



isStreaming
boolean isStreaming()(Code)
Tells whether this entity depends on an underlying stream. Streamed entities should return true until the content has been consumed, false afterwards. Self-contained entities should return false. Wrapping entities should delegate this call to the wrapped entity.
The content of a streamed entity is consumed when the stream returned by HttpEntity.getContent getContent has been read to EOF, or after HttpEntity.consumeContent consumeContent has been called. If a streamed entity can not detect whether the stream has been read to EOF, it should return true until HttpEntity.consumeContent consumeContent is called. true if the entity content is streamed andnot yet consumed, false otherwise



writeTo
void writeTo(OutputStream outstream) throws IOException(Code)
Writes the entity content to the output stream.
Parameters:
  outstream - the output stream to write entity content to
throws:
  IOException - if an I/O error occurs



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.