I have several input formats mostly restricted to geotiff and some proprietary binary formats. I import them into my program and then need to export them into various other data formats (also binary) but as two dimensional arrays.

Currently I hold the data after importing them into my program as a byte array. I also need to perform search and replace on element of this data. Is the byte array the best data structure for this sort of application ?

Summary - all of my input formats are binary(geotiff and proprietary) and all of my export formats are binary(two dimensional arrays). In between import and export I need to do some search and replace. Is byte array the best data structure for this sort of application ?

  • Are you searching and replacing byte sequences, or something different? Without knowing that, it's impossible to tell. – Kilian Foth Feb 16 '15 at 7:46
  • @KilianFoth - I search and replace byte sequences. – gansub Feb 16 '15 at 7:47
  • 2
    Then holding bytes in memory is a reasonable thing to do. (If you need to replace sequences with sequences of a different length, then an array may be less workable than a dynamic data structure, though.) – Kilian Foth Feb 16 '15 at 7:49
  • @KilianFoth - replaced sequences are also of same length. So shall I delete my question or leave it ? Since it looks like you answered it. – gansub Feb 16 '15 at 7:50
  • 2
    It's perfectly permissible to answer your own question and even to accept it. Why not try it out? The point if this site is to generate a repo of valuable answers, not to boost anyone's ego. – Kilian Foth Feb 16 '15 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.