On Wed, 2011-05-11 at 16:42 -0400, Edward Sumerfield wrote: > Bytes read from an input stream go into buffer and you control how long that > is. However, you don't need to increase the size but should always read the > stream dry before finishing. > > The jdk methods usually return the # bytes read or -1 for end of stream. You > just keep calling read until you get eos. > > You don't need to read bytes one at a time. Instead wrap your input stream > in a buffered input stream so you can read many at once. This is far more > efficient. >
Just one small remark. HttpClient maintains an internal session buffer (8kb per default) for all read operations, which makes additional buffering unnecessary. Ironically, wrapping of content stream with an BufferedInputStream likely makes data streaming less efficient. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
