Class JsonPatch
java.lang.Object
ghidra.app.util.bin.format.golang.rtti.JsonPatch
Represents a sequence of operations that describe how a json file has changed.
This implementation currently only supports reading jd (https://github.com/josephburnett/jd) native format diffs.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic enumstatic final record -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintstatic JsonPatchread(com.google.gson.JsonArray patchSectionElements) Creates a new instance using the contents of the jsonarray.static JsonPatchCreates a new instance using the contents of the supplied file.static JsonPatchCreates a new instance using the contents in the supplied string.static JsonPatchread(ListIterator<String> lineIterator) Creates a new instance using the contents of the supplied text lines.com.google.gson.JsonArraytoJson()Converts this patch to a json array.
-
Constructor Details
-
JsonPatch
-
-
Method Details
-
read
Creates a new instance using the contents in the supplied string.- Parameters:
patchString- diff text- Returns:
- new JsonPatch instance
- Throws:
IOException- if error
-
read
Creates a new instance using the contents of the supplied file.- Parameters:
patchFile- path to file containing json diff- Returns:
- new JsonPatch instance
- Throws:
IOException- if error
-
read
Creates a new instance using the contents of the supplied text lines.- Parameters:
lineIterator- iterator that provides lines of text containing the json diff- Returns:
- new JsonPatch instance
- Throws:
IOException- if error
-
read
Creates a new instance using the contents of the jsonarray. Allows storing a json patch in a json document.- Parameters:
patchSectionElements- json array containing the json diff sections- Returns:
- new JsonPatch instance
- Throws:
IOException- if error
-
getSectionCount
public int getSectionCount() -
getSections
-
toJson
public com.google.gson.JsonArray toJson()Converts this patch to a json array.- Returns:
- json array with json encoded patch/diff elements.
-