To put it simply, i am trying to replace a certain character in a non-text file (to be specific, a zip file, for a certain experimental project). The goal is to automate something that can be done in a hex editor.
In python, there is something like "data.replace(b'^', b'/') [data is just the file variable]", but I am not sure which is a counterpart for B4A.
B4XBytesBuilder (B4XCollections) can be useful for such tasks though for a single byte you can do something simpler:
B4X:
Dim data() As Byte = File.ReadBytes(...)
For i = 0 To b.Length - 1
if Bit.And(0xff, data(i)) = 0x32 Then data(i) = 0x64 'the and is required if the value > 127 because bytes are signed
Next
File.WriteBytes(...)
B4XBytesBuilder (B4XCollections) can be useful for such tasks though for a single byte you can do something simpler:
B4X:
Dim data() As Byte = File.ReadBytes(...)
For i = 0 To b.Length - 1
if Bit.And(0xff, data(i)) = 0x32 Then data(i) = 0x64 'the and is required if the value > 127 because bytes are signed
Next
File.WriteBytes(...)