I am trying to implement a buffer in an android application so I can buffer an incoming stream of byte arrays from a bluetooth connection. I need to do some processing of the byte arrays as i receive them, and that is why I would like to use some sort of buffering.
Basically, I would receive a byte array, store it in the buffer, and then while the next byte arrays are coming into the buffer, I would be pulling them out in the order that they came in to do my processing. In other words, I would need a first in, first out implementation.
Could anyone point me in the right direction as to what type of buffer I should use? I am not sure if there is a specific name for what I am looking for. If you could direct me to some good resources for buffer implementation, that would also be very useful.
If any of this isn’t clear, please ask and I will do my best to clarify.
Are you buffering the bytes coming in, or arrays of bytes? If you are buffering arrays of bytes, you might want a LinkedBlockingQueue