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

public class PatchPackedEncode extends PackedEncode implements PatchEncoder
  • 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 interface PatchEncoder
      Returns:
      the number of bytes written to this stream so far
    • writeSpaceId

      public void writeSpaceId(AttributeId attribId, long spaceId) throws IOException
      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 interface PatchEncoder
      Parameters:
      attribId - is the attribute
      spaceId - is the given spaceid
      Throws:
      IOException - for problems writing to the stream
    • patchIntegerAttribute

      public boolean patchIntegerAttribute(int pos, AttributeId attribId, long val)
      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 interface PatchEncoder
      Parameters:
      pos - is the given position
      attribId - is the attribute to be patched
      val - 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 interface CachedEncoder
    • 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 interface CachedEncoder
      Returns:
      true if there are no bytes in the encoder
    • writeTo

      public void writeTo(OutputStream stream) throws IOException
      Description copied from interface: CachedEncoder
      Dump all the accumulated bytes in this encoder to the stream.
      Specified by:
      writeTo in interface CachedEncoder
      Parameters:
      stream - is the output stream
      Throws:
      IOException - for errors during the write operation