Package ghidra.program.model.pcode
Class PackedEncode
java.lang.Object
ghidra.program.model.pcode.PackedEncode
- All Implemented Interfaces:
- Encoder
- Direct Known Subclasses:
- PatchPackedEncode
A byte-based encoder designed to marshal to the decompiler efficiently
 See 
PackedDecode for details of the encoding format- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidcloseElement(ElementId elemId) End the current element in the encoding The current element must match the given annotation or an exception is thrown.voidopenElement(ElementId elemId) Begin a new element in the encoding The element will have the given ElementId annotation and becomes the \e current element.voidwriteBool(AttributeId attribId, boolean val) Write an annotated boolean value into the encoding The boolean data is associated with the given AttributeId annotation and the current open element.protected voidwriteHeader(int header, int id) protected voidwriteInteger(int typeByte, long val) voidwriteOpcode(AttributeId attribId, int opcode) Write a p-code operation opcode into the encoding, associating it with the given annotation.voidwriteSignedInteger(AttributeId attribId, long val) Write an annotated signed integer value into the encoding The integer is associated with the given AttributeId annotation and the current open element.voidwriteSpace(AttributeId attribId, int index, String name) Write an address space reference into the encoding.voidwriteSpace(AttributeId attribId, AddressSpace spc) Write an address space reference into the encoding The address space is associated with the given AttributeId annotation and the current open element.voidwriteString(AttributeId attribId, String val) Write an annotated string into the encoding The string is associated with the given AttributeId annotation and the current open element.voidwriteStringIndexed(AttributeId attribId, int index, String val) Write an annotated string, using an indexed attribute, into the encoding.voidwriteUnsignedInteger(AttributeId attribId, long val) Write an annotated unsigned integer value into the encoding The integer is associated with the given AttributeId annotation and the current open element.
- 
Field Details- 
outStream
 
- 
- 
Constructor Details- 
PackedEncodepublic PackedEncode()
- 
PackedEncode
 
- 
- 
Method Details- 
writeHeader- Throws:
- IOException
 
- 
writeInteger- Throws:
- IOException
 
- 
openElementDescription copied from interface:EncoderBegin a new element in the encoding The element will have the given ElementId annotation and becomes the \e current element.- Specified by:
- openElementin interface- Encoder
- Parameters:
- elemId- is the given ElementId annotation
- Throws:
- IOException- for errors in the underlying stream
 
- 
closeElementDescription copied from interface:EncoderEnd the current element in the encoding The current element must match the given annotation or an exception is thrown.- Specified by:
- closeElementin interface- Encoder
- Parameters:
- elemId- is the given (expected) annotation for the current element
- Throws:
- IOException- for errors in the underlying stream
 
- 
writeBoolDescription copied from interface:EncoderWrite an annotated boolean value into the encoding The boolean data is associated with the given AttributeId annotation and the current open element.- Specified by:
- writeBoolin interface- Encoder
- Parameters:
- attribId- is the given AttributeId annotation
- val- is boolean value to encode
- Throws:
- IOException- for errors in the underlying stream
 
- 
writeSignedIntegerDescription copied from interface:EncoderWrite an annotated signed integer value into the encoding The integer is associated with the given AttributeId annotation and the current open element.- Specified by:
- writeSignedIntegerin interface- Encoder
- Parameters:
- attribId- is the given AttributeId annotation
- val- is the signed integer value to encode
- Throws:
- IOException- for errors in the underlying stream
 
- 
writeUnsignedIntegerDescription copied from interface:EncoderWrite an annotated unsigned integer value into the encoding The integer is associated with the given AttributeId annotation and the current open element.- Specified by:
- writeUnsignedIntegerin interface- Encoder
- Parameters:
- attribId- is the given AttributeId annotation
- val- is the unsigned integer value to encode
- Throws:
- IOException- for errors in the underlying stream
 
- 
writeStringDescription copied from interface:EncoderWrite an annotated string into the encoding The string is associated with the given AttributeId annotation and the current open element.- Specified by:
- writeStringin interface- Encoder
- Parameters:
- attribId- is the given AttributeId annotation
- val- is the string to encode
- Throws:
- IOException- for errors in the underlying stream
 
- 
writeStringIndexedDescription copied from interface:EncoderWrite an annotated string, using an indexed attribute, into the encoding. Multiple attributes with a shared name can be written to the same element by calling this method multiple times with a different index value. The encoding will use attribute ids up to the base id plus the maximum index passed in. Implementors must be careful to not use other attributes with ids bigger than the base id within the element taking the indexed attribute.- Specified by:
- writeStringIndexedin interface- Encoder
- Parameters:
- attribId- is the shared AttributeId
- index- is the unique index to associated with the string
- val- is the string to encode
- Throws:
- IOException- for errors in the underlying stream
 
- 
writeSpaceDescription copied from interface:EncoderWrite an address space reference into the encoding The address space is associated with the given AttributeId annotation and the current open element.- Specified by:
- writeSpacein interface- Encoder
- Parameters:
- attribId- is the given AttributeId annotation
- spc- is the address space to encode
- Throws:
- IOException- for errors in the underlying stream
 
- 
writeSpaceDescription copied from interface:EncoderWrite an address space reference into the encoding. An address space identified by its name and unique index is associated with the given annotation and the current open element.- Specified by:
- writeSpacein interface- Encoder
- Parameters:
- attribId- is the given annotation
- index- is the unique index of the address space
- name- is the name of the address space
- Throws:
- IOException- for errors in the underlying stream
 
- 
writeOpcodeDescription copied from interface:EncoderWrite a p-code operation opcode into the encoding, associating it with the given annotation. The opcode is specified based on the constants defined inPcodeOp.- Specified by:
- writeOpcodein interface- Encoder
- Parameters:
- attribId- is the given annotation
- opcode- is the opcode constant
- Throws:
- IOException- for errors in the underlying stream
 
- 
getOutputStream- Returns:
- the underlying stream
 
 
-