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 8852091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:18:53+00:00 2026-06-14T13:18:53+00:00

I want to read bytes from httpresponse coming from server continuosly into an array.

  • 0

I want to read bytes from httpresponse coming from server continuosly into an array.

I’m creating a byte array with a maximum size of 2048.

So, I wanted to create a dynamically increasing array and I found that ArrayList is the solution.

How can i overcome this solution?

Any help would be appreciated lot

  • 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-06-14T13:18:54+00:00Added an answer on June 14, 2026 at 1:18 pm

    You can have an array of byte like:

    List<Byte> arrays = new ArrayList<Byte>();

    To convert it back to arrays

    Byte[] soundBytes = arrays.toArray(new Byte[arrays.size()]);

    – You can also use ByteArrayInputStream and ByteArrayOutputStream.

    Eg:

    InputStream inputStream = socket.getInputStream();  
    
    // read from the stream  
    ByteArrayOutputStream baos = new ByteArrayOutputStream();  
    byte[] content = new byte[ 2048 ];  
    int bytesRead = -1;  
    while( ( bytesRead = inputStream.read( content ) ) != -1 ) {  
        baos.write( content, 0, bytesRead );  
    } // while  
    
    // now, as you have baos in hand, I don't think you still need a bais instance  
    // but, to make it complete,
    // now you can generate byte array input stream as below    
    ByteArrayInputStream bais = new ByteArrayInputStream( baos.toByteArray() );  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to read bytes from a wave file into an array. Since the
After you establish a connection and you want to read the bytes coming from
I want to be able to read bytes from a min and max hexadecimal
I want to read exactly n bytes from a Socket at a time. How
I want to read bytes from a file and then write those bytes to
I want to read a sequence of bytes from my accelerometer. I can't get
I want to read unsigned bytes from a binary file. So I wrote the
Is it possible to get specific bytes from a byte array in java? I
I have a huge binary file from which I want to read some bytes
I want to read N bytes of data from a file stream and append

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.