Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6373839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:24:52+00:00 2026-05-25T01:24:52+00:00

As you might know for sending chunked file in HTTP header, there is no

  • 0

As you might know for sending chunked file in HTTP header, there is no content length, so the program must wait for 0 to understand that file ended.

--sample http header  
POST /some/path HTTP/1.1
Host: www.example.com  
Content-Type: text/plain  
Transfer-Encoding: chunked  
25  
This is the data in the first chunk  
8
sequence  
0

for receiving this file the following code can be used.

ResponseHandler<String> reshandler = new ResponseHandler<String>() {
    public String handleResponse(HttpResponse response) throws ClientProtocolException, IOException {

        HttpEntity entity = response.getEntity();

        InputStream in =  entity.getContent();
        byte[] b = new byte[500];
        StringBuffer out = new StringBuffer();
        int len = in.read(b);
        out.append(new String(b, 0 , len));

        return out.toString();
    }
}; 

but in my case, I work with streaming channel in other word there is no 0 that shows that file ended. anyway if I use this code, it seems that it waits forever to wait for 0 which never happen. my question is there any better approach to receive chunked file from stream channel?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T01:24:53+00:00Added an answer on May 25, 2026 at 1:24 am

    Ok. I could receive the data by using simple approach(as following and without using Response Handler). anyway I’m still a bit confuse about apache ChunkedInputStream and how it could be usefual while normall inputstream can handle the chunked data.

    is =  entity.getContent();
    StringBuffer out = new StringBuffer();
    byte[] b = new byte[800];
    int len = is.read(b);
    out.append(new String(b, 0 , len));
    result = out.toString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As you all might know that the MIPS instruction set supports clz (count leading
As you might know, it's now possible to trace Erlang functions by using the
To recap for those .NET gurus who might not know the Java API: ConcurrentHashMap
I know this might be a no-brainer, but please read on. I also know
I know it might not be according to Apple's human interface guidelines for the
I know this might be a long shot, but here it goes. I have
I know this might be a bit awkward but I am trying to modify
I know this might be very easy to some,, I have a simple string
I know this might seem a controversial question but it really is not meant
Know this might be rather basic, but I been trying to figure out how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.