The following code reads data from a file using a BufferedInputStream and processes it in chuncks. I would like to modify this code so that instead of the data coming from a file through a stream, I would like to have it come from a byte array. I have already read the file's data into a byte array and I want to use this while...loop to process the array data instead of working with the data from the file stream. Not sure how to do it:
FileInputStream in = new FileInputStream(inputFile);
BufferedInputStream origin = new BufferedInputStream(in, BUFFER);
int count;
while ((count = origin.read(data, 0, BUFFER)) != -1)
{
  // Do something
}

