Return-Path: Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: (qmail 58251 invoked from network); 13 Feb 2011 15:49:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Feb 2011 15:49:16 -0000 Received: (qmail 66197 invoked by uid 500); 13 Feb 2011 15:49:15 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 65902 invoked by uid 500); 13 Feb 2011 15:49:11 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 65894 invoked by uid 99); 13 Feb 2011 15:49:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 Feb 2011 15:49:10 +0000 X-ASF-Spam-Status: No, hits=1.2 required=5.0 tests=FORGED_HOTMAIL_RCVD2,FREEMAIL_FROM,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.26 as permitted sender) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 Feb 2011 15:49:04 +0000 Received: from isper.nabble.com ([192.168.236.156]) by sam.nabble.com with esmtp (Exim 4.69) (envelope-from ) id 1PoeBo-000867-12 for httpclient-users@hc.apache.org; Sun, 13 Feb 2011 07:48:44 -0800 Message-ID: <30915038.post@talk.nabble.com> Date: Sun, 13 Feb 2011 07:48:44 -0800 (PST) From: Robyp1 To: httpclient-users@hc.apache.org Subject: anaging streaming http connection MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: robyp1@hotmail.com hi, i have a problem.. I try to read from a web server that stream video and audio content media : flv type i make http request using HttpGet class from org.apache.http.client.methods to this server url like this : HttpGet get = new HttpGet(url) HttpResponse response = myHttpClientObject.execute(get); but when i try to read content in a buffer like this: entity = response.getEntity(); if (entity != null) { InputStream instream = entity.getContent(); System.out.println("**Entity content-length " + entity.getContentLength()); //it is 2147483647! byte[] b = EntityUtils.toByteArray(entity); <-- using this utility with a dinamic resizing array of bytes i get a **Entity content-length 2147483647 Exception in thread "pool-1-thread-3" java.lang.OutOfMemoryError: Java heap space java.lang.OutOfMemoryError: Java heap space at org.apache.http.util.ByteArrayBuffer.(ByteArrayBuffer.java:55) at org.apache.http.util.EntityUtils.toByteArray(EntityUtils.java:96) beacuse the constructor of ByteArrayBuffer creat a new byte[2147483647] array what is wrong..i suppose that because my resource is not static i must use a chunk mode, really?? but how i can use it with HttpGet??.. i think HttpPot is not supported by server beacuse i get a http page with a forbidden message(you're not authorized). But using a HttpGet and read by a inputStreamer (not the right choice with 8 bit content type) i get the streaming source: //StringBuffer httpResponse = new StringBuffer(); // input = new BufferedReader(new InputStreamReader(instream)); // String resp = "null"; // while (resp != null && !(resp).equals("")) { // log.log(Level.INFO, resp); // resp = input.readLine(); // httpResponse.append(resp); // } I have to get this output and send it to a vlc player or any kind of flv stream player .. thank you Bye Roby -- View this message in context: http://old.nabble.com/anaging-streaming-http-connection-tp30915038p30915038.html Sent from the HttpClient-User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org