How to add bytes to a byte array?

Asked

Viewed 61 times

0

Boas. How do I add one byte[] to another byte[]?

Byte1.add(byte2);

Giving more code will not help in understanding the problem. But I will explain better.

I have a byte[] called fullbytecoll[] that will store all bytes[] collected.

Then I have a loop that will always give me several byte 'Chunks' [] that I intend to add to the end of fullbytecoll[]. So I need a way to add date to my byte array.

  • 1

    Needs to be array? Arrays cannot be resized. I mean, it’s even possible, but it involves a considerable amount of work and that’s probably not what you’re looking for.

  • 1

    What is your difficulty? Enter a more complete code, let us know if there are any problems.

  • I added more information.

  • There really is no way, either switch to the list or reserve enough space for all bytes. The alternative would be to create new arrays as it needs more space, but this is what the List does more correctly than most programmers would do manually. This can help a little understand the possible operations of each collection: http://answall.com/q/76316/101

  • I tried to do it by list. and I have listDecomp.Add(Decompressedb); , and at the end of the loop, I intend to go back to byte. How do I do that?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.