Package ghidra.program.model.pcode
Class PatchPackedEncode
java.lang.Object
ghidra.program.model.pcode.PackedEncode
ghidra.program.model.pcode.PatchPackedEncode
- All Implemented Interfaces:
CachedEncoder
,Encoder
,PatchEncoder
- Direct Known Subclasses:
PackedEncodeOverlay
-
Field Summary
Fields inherited from class ghidra.program.model.pcode.PackedEncode
outStream
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear any state associated with the encoder The encoder should be ready to write a new document after this call.boolean
isEmpty()
The encoder is considered empty if the writeTo() method would output zero bytesboolean
patchIntegerAttribute
(int pos, AttributeId attribId, long val) Replace an integer attribute for the element at the given position.int
size()
The returned value can be used as a position for later modificationvoid
writeSpaceId
(AttributeId attribId, long spaceId) Write a given raw spaceid (as returned by AddressSpace.getSpaceID()) as an attribute.void
writeTo
(OutputStream stream) Dump all the accumulated bytes in this encoder to the stream.Methods inherited from class ghidra.program.model.pcode.PackedEncode
closeElement, getOutputStream, openElement, writeBool, writeHeader, writeInteger, writeOpcode, writeSignedInteger, writeSpace, writeSpace, writeString, writeStringIndexed, writeUnsignedInteger
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ghidra.program.model.pcode.Encoder
closeElement, openElement, writeBool, writeOpcode, writeSignedInteger, writeSpace, writeSpace, writeString, writeStringIndexed, writeUnsignedInteger
-
Constructor Details
-
PatchPackedEncode
public PatchPackedEncode()
-
-
Method Details
-
size
public int size()Description copied from interface:PatchEncoder
The returned value can be used as a position for later modification- Specified by:
size
in interfacePatchEncoder
- Returns:
- the number of bytes written to this stream so far
-
writeSpaceId
Description copied from interface:PatchEncoder
Write a given raw spaceid (as returned by AddressSpace.getSpaceID()) as an attribute. The effect is the same as if writeSpace() was called with the AddressSpace matching the spaceid, i.e. the decoder will read this as just space attribute.- Specified by:
writeSpaceId
in interfacePatchEncoder
- Parameters:
attribId
- is the attributespaceId
- is the given spaceid- Throws:
IOException
- for problems writing to the stream
-
patchIntegerAttribute
Description copied from interface:PatchEncoder
Replace an integer attribute for the element at the given position. The position is assumed to be at an open directive for the element containing the attribute to be patched.- Specified by:
patchIntegerAttribute
in interfacePatchEncoder
- Parameters:
pos
- is the given positionattribId
- is the attribute to be patchedval
- is the new value to insert- Returns:
- true if the attribute is successfully patched
-
clear
public void clear()Description copied from interface:CachedEncoder
Clear any state associated with the encoder The encoder should be ready to write a new document after this call.- Specified by:
clear
in interfaceCachedEncoder
-
isEmpty
public boolean isEmpty()Description copied from interface:CachedEncoder
The encoder is considered empty if the writeTo() method would output zero bytes- Specified by:
isEmpty
in interfaceCachedEncoder
- Returns:
- true if there are no bytes in the encoder
-
writeTo
Description copied from interface:CachedEncoder
Dump all the accumulated bytes in this encoder to the stream.- Specified by:
writeTo
in interfaceCachedEncoder
- Parameters:
stream
- is the output stream- Throws:
IOException
- for errors during the write operation
-