Skip to content

Commit

Permalink
RawCopy docs updated: infinite line
Browse files Browse the repository at this point in the history
  • Loading branch information
arekbulski committed Feb 6, 2021
1 parent ce1b5f9 commit aedc195
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 1 addition & 5 deletions construct/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4235,11 +4235,7 @@ class RawCopy(Subconstruct):
Object is a dictionary with either "data" or "value" keys, or both.
When building, if both the "value" and data "keys" are present, then the
"data" key is used, and the "value" key ignored. This is undesirable in the
case that you parse some data for the purpose of modifying it and writing
it back; in this case, delete the "data" key when modifying the "value" key
to correctly rebuild the former.
When building, if both the "value" and "data" keys are present, then the "data" key is used and the "value" key is ignored. This is undesirable in the case that you parse some data for the purpose of modifying it and writing it back; in this case, delete the "data" key when modifying the "value" key to correctly rebuild the former.
:param subcon: Construct instance
Expand Down
2 changes: 2 additions & 0 deletions docs/tunneling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Obtaining raw bytes

When some value needs to be processed as both a parsed object and its raw bytes representation, both of these can be obtained using RawCopy. You can build from either the object or raw bytes as well. Dict also happen to contain the stream offsets, if you need to know at which position it resides in the stream or if you need to know its size in bytes.

When building, if both the "value" and "data" keys are present, then the "data" key is used and the "value" key is ignored. This is undesirable in the case that you parse some data for the purpose of modifying it and writing it back; in this case, delete the "data" key when modifying the "value" key to correctly rebuild the former.

>>> d = RawCopy(Byte)
>>> d.parse(b"\xff")
Container(data=b'\xff', value=255, offset1=0, offset2=1, length=1)
Expand Down

0 comments on commit aedc195

Please sign in to comment.