• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Fast way to write and read buffered data

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a working implementation of the AudioRecrod class. I however I
need the samples only in a buffered form so I don't want to save them
on the phone hard memory, but keep them in a buffered way. Write now I
am saving the files using an ArrayList of type <Short> like that:

for (int idxBuffer = 0; idxBuffer < bufferRead; ++idxBuffer) {
buffer.add(tempBuffer[idxBuffer]);

}

However you can tell that ArrayList is not an effective way to do
this, and also the values are saved as Short not short. I was thinking
about using some of the stream buffers but they mostly only work with
byte[] arrays not short[]. yes I can convert the short to byte but
that again takes some more time...

What would be the fastest way to do it? Every source I googled seems
to be using the 'save to file' approach which definitely can't be the
fastest way. What would you suggest?
 
reply
    Bookmark Topic Watch Topic
  • New Topic