docs: def entry_fields(file, entry_pos, field_delim="\xFF"):
      '''From an ecc entry position (a list with starting and ending positions), extract the metadata fields (filename, filesize, ecc for both), and the starting/ending positions of the ecc stream (containing variably encoded blocks of hash and ecc per blocks of the original file's header)'''
      # Read the the beginning of the ecc entry
      blocksize = 65535
      file.seek(entry_pos[0])
      entry = file.read(blocksize)
      entry = entry.lstrip(field_delim) # if there was some slight adjustment error (example: the last ecc block of the last file was the field_delim, then we will start with a field_delim, and thus we need to remove the trailing field_delim which is useless and will make the field detection buggy). This is not really a big problem for the previous file's ecc block: the missing ecc characters (which were mistaken for a field_delim), will just be missing (so we will lose a bit of resiliency for the last block of the previous file, but that's not a huge issue, the correction can still rely on the other characters).
      # TODO: do in a while loop in case the filename is really big (bigger than blocksize) - or in case we add intra-ecc for filename
  
      # Find metadata fields delimiters positions
      # TODO: automate this part, just give in argument the number of field_delim to find, and the func will find the x field_delims (the number needs to be specified in argument because the field_delim can maybe be found wrongly inside the ecc stream, which we don't want)
      first = entry.find(field_delim)
      second = entry.find(field_delim, first+len(field_delim))
      third = entry.find(field_delim, second+len(field_delim))
      fourth = entry.find(field_delim, third+len(field_delim))
      # Note: we do not try to find all the field delimiters because we optimize here: we just walk the string to find the exact number of field_delim we are looking for, and after we stop, no need to walk through the whole string.
  
      # Extract the content of the fields
      # Metadata fields
      relfilepath = entry[:first]
      filesize = entry[first+len(field_delim):second]
      relfilepath_ecc = entry[second+len(field_delim):third]
      filesize_ecc = entry[third+len(field_delim):fourth]
      # Ecc stream field (aka ecc blocks)
      ecc_field_pos = [entry_pos[0]+fourth+len(field_delim), entry_pos[1]] # return the starting and ending position of the rest of the ecc track, which contains blocks of hash/ecc of the original file's content.
  
      # Place the cursor at the beginning of the ecc_field
      file.seek(ecc_field_pos[0])
  
      # Try to convert to an int, an error may happen
      try:
          filesize = int(filesize)
      except Exception, e:
          print("Exception when trying to detect the filesize in ecc field (it may be corrupted), skipping: ")
          print(e)
          #filesize = 0 # avoid setting to 0, we keep as an int so that we can try to fix using intra-ecc
  
      # entries = [ {"message":, "ecc":, "hash":}, etc.]
      return {"relfilepath": relfilepath, "relfilepath_ecc": relfilepath_ecc, "filesize": filesize, "filesize_ecc": filesize_ecc, "ecc_field_pos": ecc_field_pos}