Dear Wiki user, You have subscribed to a wiki page or wiki category on "Httpcomponents Wiki" for change notification.
The following page has been changed by QuintinBeukes: http://wiki.apache.org/HttpComponents/HttpEntity The comment on the change is: Completed initial version. ------------------------------------------------------------------------------ a. [#ByteArrayEntity ByteArrayEntity] a. [#EntityTemplate EntityTemplate] a. [#FileEntity FileEntity] - a. [#HttpEntityWrapper HttpEntityWrapper] a. [#InputStreamEntity InputStreamEntity] a. [#StringEntity StringEntity] a. [#AbstractHttpEntity AbstractHttpEntity] + a. [#HttpEntityWrapper HttpEntityWrapper] [[Anchor(BasicHttpEntity)]] === BasicHttpEntity === @@ -131, +131 @@ HttpEntity entity = new FileEntity(staticFile, "application/java-archive"); }}} - [[Anchor(HttpEntityWrapper)]] - === HttpEntityWrapper === - ... To be completed ... - [[Anchor(InputStreamEntity)]] === InputStreamEntity === - ... To be completed ... + An entity that reads it's content from an input stream. It is constructed by supplied the input stream as well as the content length. + + The content length is used to limit the amount of data read from the InputStream. If the length matches the content length available on the input stream, then all data will be sent. Alternatively a negative content length will read all data from the input stream, which is the same as supplying the exact content length, so the length is most often used to limit the length. + + {{{#!java numbers=off + InputStream instream = getSomeInputStream(); + InputStreamEntity myEntity = new InputStreamEntity(instream, 16); + }}} [[Anchor(StringEntity)]] === StringEntity === - ... To be completed ... + Very simple entity. It's is a self contained, repeatable entity that retrieves it's data from a String object. + + It has 2 constructors, one simply constructs with a given String object where the other also takes a character encoding for the data in the String. + + {{{#!java numbers=off + StringBuffer sb = new StringBuffer(); + Map<String, String> env = System.getenv(); + for (Entry<String, String> envEntry : env.entrySet()) + { + sb.append(envEntry.getKey()).append(": ").append(envEntry.getValue()).append("\n"); + } + + // construct without a character encoding + HttpEntity myEntity1 = new StringEntity(sb.toString()); + + // alternatively construct with an encoding + HttpEntity myEntity2 = new StringEntity(sb.toString(), "UTF-8"); + }}} [[Anchor(AbstractHttpEntity)]] === AbstractHttpEntity === - ... To be completed ... + This is the base class for streaming and self contained entities. It provides all the commonly used attributes used by these entities, like contentEncoding, contentType and the chunked flag. + [[Anchor(HttpEntityWrapper)]] + === HttpEntityWrapper === + This is the base class for creating wrapped entities. It contains an instance variable wrappedEntity which holds the instance to the wrapped entity. + + BufferedHttpEntity is a subclass of HttpEntityWrapper. + --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
