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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:39:09+00:00 2026-06-14T19:39:09+00:00

I am reading an array of bytes passed in to me (not my choice,

  • 0

I am reading an array of bytes passed in to me (not my choice, but i have to use it this way). I need to get the data to a LinkedBlockingQueue, and ultimately step through the bytes to build one or more (may contain partial messages) xml messages. So my question is this:

What generic should i use for the LBQ type?
what is the most efficient way to get the byte[] to that generic type?

Here is my example code:

parsebytes(byte[] bytes, int length)
{
    //assume that i am doing other checks on data

    if (length > 0)
    {
        myThread.putBytes(bytes, length);
    }
}

in my thread:

putBytes(byte[] bytes, int length)
{
    for (int i = 0; i < length; i++)
    { 
        blockingQueue.put(bytes[i]);
    }
}

I also do not want to have to pull off the blocking queue byte-by-byte either. I would rather grab everything that is in the queue and process it.

  • 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-14T19:39:10+00:00Added an answer on June 14, 2026 at 7:39 pm

    There is no such thing as a ListBlockingQueue. However, any BlockingQueue<Object> will accept byte[] since Java arrays are objects.

    In the absence of other design considerations, the simplest option might be to just stick the arrays into the queue as they arrive, and let the consumer stich them together.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm reading data from a stream into a char array of a given length,
I'm reading this post . It defines a simple array: var myArray = [1,
I have a Boost.MultiIndex big array about 10Gb. In order to reduce the reading
I have 3 arrays of data, that are filled by reading off of an
I have c++ code that attempts to dynamically allocate a 2d array of bytes
Can anyone tell me how to get a array of bytes into a structure
Basically I'm reading all the bytes from a file into a byte array using
I'm using C# and reading bytes array from some controller and converting them to
I have an array of bytes that has come from a barcode reader (connected
I need a method that reads a file to a byte array asynchronously but

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.