# pydicom.fileutil.read_undefined_length_value

pydicom.fileutil.read_undefined_length_value(fp: BinaryIO, is_little_endian: bool, delimiter_tag: pydicom.tag.BaseTag, defer_size: Optional[Union[int, float]] = None, read_size: int = 8192) → Optional[bytes]

  Read until delimiter_tag and return the value up to that point.

  On completion, the file will be set to the first byte after the delimiter and its following four zero bytes.

  Parameters

    - fp (file-like) – The file-like to read.

    - is_little_endian (bool) – `True` if file transfer syntax is little endian, else `False`.

    - delimiter_tag (BaseTag) – Tag used as end marker for reading

    - defer_size (int or None, optional) – Size to avoid loading large elements in memory. See `dcmread()` for more parameter info.

    - read_size (int, optional) – Number of bytes to read at one time.

  Returns

    delimiter – The file delimiter.

  Return type

    bytes or None

  Raises

    EOFError – If EOF is reached before delimiter found.