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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear any state associated with the encoder The encoder should be ready to write a new document after this call.booleanisEmpty()The encoder is considered empty if the writeTo() method would output zero bytesbooleanpatchIntegerAttribute(int pos, AttributeId attribId, long val) Replace an integer attribute for the element at the given position.intsize()The returned value can be used as a position for later modificationvoidwriteSpaceId(AttributeId attribId, long spaceId) Write a given raw spaceid (as returned by AddressSpace.getSpaceID()) as an attribute.voidwriteTo(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, writeUnsignedIntegerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:PatchEncoderThe returned value can be used as a position for later modification- Specified by:
sizein interfacePatchEncoder- Returns:
- the number of bytes written to this stream so far
-
writeSpaceId
Description copied from interface:PatchEncoderWrite 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:
writeSpaceIdin interfacePatchEncoder- Parameters:
attribId- is the attributespaceId- is the given spaceid- Throws:
IOException- for problems writing to the stream
-
patchIntegerAttribute
Description copied from interface:PatchEncoderReplace 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:
patchIntegerAttributein 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:CachedEncoderClear any state associated with the encoder The encoder should be ready to write a new document after this call.- Specified by:
clearin interfaceCachedEncoder
-
isEmpty
public boolean isEmpty()Description copied from interface:CachedEncoderThe encoder is considered empty if the writeTo() method would output zero bytes- Specified by:
isEmptyin interfaceCachedEncoder- Returns:
- true if there are no bytes in the encoder
-
writeTo
Description copied from interface:CachedEncoderDump all the accumulated bytes in this encoder to the stream.- Specified by:
writeToin interfaceCachedEncoder- Parameters:
stream- is the output stream- Throws:
IOException- for errors during the write operation
-