What Happens if i create a byte array continuously in a while loop with different size and add read an stream into it?

Posted by SajidKhan on Stack Overflow See other posts from Stack Overflow or by SajidKhan
Published on 2013-10-30T09:51:02Z Indexed on 2013/10/30 9:53 UTC
Read the original article Hit count: 148

Filed under:

I want to read an audio file into multiple byte arrays , with different size . And then add into a shared memory.

What will happen if use below code. Does the byte array gets over written. I understand it will creat multiple byte array , how do i erase those byte arrays after my code does what it needs to do.

              int TotalBuffer = 10;
            while (TotalBuffer !=0){
              bufferData = new byte[AClipTextFileHandler.BufferSize.get(j)];
              input.read(bufferData);
              Sharedbuffer.put(bufferData);
              i++;
              j++;
              TotalBuffer--;

    }

© Stack Overflow or respective owner

Related posts about java