Android Question Search byte sequence in file, and extract portions from it

designer2k2

Member
Licensed User
Longtime User
Hello,

im lost in searching for a way to get this done

I have a file, where i need to find 2 byte sequences, and then extract the data between this 2 positions into a new file.

This is simple in python:
B4X:
pos1 = data.find(bytes([0x13, 0x43, 0x44, 0x3f])
pos2 = data.find(bytes([0x12, 0x34, 0x3f])
new = data[pos1:pos2-pos1]

but in B4A the byte array has no search function?

I read the file like this:
B4X:
Dim b as Bytes()
b = File.ReadBytes(Dir,Path)

Any idea or direction what i can follow up to get this going?

greetings,
d2k2
 

Similar Threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…