Can you perhaps just use java.io.SequenceInputStream, by creating simple dummy input stream for content type part (new ByteArrayInputStream(headerString.getBytes([whatever-encoding -you-got])) and chain this with body contents?
It also seems strange that a library (mime4j) would require access to parts it basically shouldn't need, so perhaps there is a way to pass this information some other way than it being part of stream? Hope this helps, -+ Tatu +- --- ripok <[EMAIL PROTECTED]> wrote: > > I have a little problemo: I'm making HTTP request to > a server that gives me > back a kind of mime message in the response, so the > content-type of the HTTP > response will be "Content-Type: > multipart/related;boundary='xxxx'". > > When I'm parsing that mime message (I use mime4j), > the parser needs that > content type declaration because there is the > boundary definition and it is > part of the message. However if I just get the > response body from > HttpMethod, that content-type declaration is not > within it because it's in > the HTTP response headers. > > One way I can handle this is to get the response > body as string (or byte > array) and add that content-type response header to > the first line of the > body before giving it to mime parser. However I > don't like this because I > want to handle the response as an InputStream to > prevent storing the whole > response in memory before handling (the response can > be quite big). > > So is there a way to get the whole HTTP response as > an InputStream, so that > there are the response headers with it. Or can I > somehow insert that content > type header to to beginning of response body > InputStream? > I'm using HttpClient version 3.1. > > -ripok- > -- > View this message in context: > http://www.nabble.com/Whole-HTTP-response-as-InputStream--tp15759846p15759846.html > Sent from the HttpClient-User mailing list archive > at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > ____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
