Package org.jf.dexlib2.util
Class AnnotatedBytes
java.lang.Object
org.jf.dexlib2.util.AnnotatedBytes
- Direct Known Subclasses:
DexAnnotator
Collects/presents a set of textual annotations, each associated with a range of bytes or a specific point
between bytes.
Point annotations cannot occur within the middle of a range annotation, only at the endpoints, or some other area
with no range annotation.
Multiple point annotations can be defined for a given point. They will be printed in insertion order.
Only a single range annotation may exist for any given range of bytes. Range annotations may not overlap.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionThis defines the bytes ranges and their associated range and point annotations.private intprivate intprivate int>= 8 (if used); the number of bytes of hex output to use in annotationsprivate intprivate int>= 40 (if used); the desired maximum output widthprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd an annotation of the given length at the current location.voidannotateTo(int offset, String msg, Object... formatArgs) voidvoiddeindent()private StringformatAnnotation(int offset, Integer endOffset, String annotationMsg) private StringformatAnnotation(int offset, String annotationMsg) intintvoidindent()voidmoveBy(int offset) Moves the cursor forward or backward by some amountvoidmoveTo(int offset) Moves the cursor to a new locationvoidsetLimit(int start, int end) voidwriteAnnotations(Writer out, byte[] data, int offset) Writes the annotated content of this instance to the given writer.
-
Field Details
-
annotatations
This defines the bytes ranges and their associated range and point annotations. A range is defined by 2 consecutive keys in the map. The first key is the inclusive start point, the second key is the exclusive end point. The range annotation for a range is associated with the first key for that range. The point annotations for a point are associated with the key at that point. -
cursor
private int cursor -
indentLevel
private int indentLevel -
outputWidth
private int outputWidth>= 40 (if used); the desired maximum output width -
hexCols
private int hexCols>= 8 (if used); the number of bytes of hex output to use in annotations -
startLimit
private int startLimit -
endLimit
private int endLimit
-
-
Constructor Details
-
AnnotatedBytes
public AnnotatedBytes(int width)
-
-
Method Details
-
moveTo
public void moveTo(int offset) Moves the cursor to a new location- Parameters:
offset- The offset to move to
-
moveBy
public void moveBy(int offset) Moves the cursor forward or backward by some amount- Parameters:
offset- The amount to move the cursor
-
annotateTo
-
annotate
Add an annotation of the given length at the current location. The location- Parameters:
length- the length of data being annotatedmsg- the annotation messageformatArgs- format arguments to pass to String.format
-
formatAnnotation
-
formatAnnotation
-
indent
public void indent() -
deindent
public void deindent() -
getCursor
public int getCursor() -
getAnnotationWidth
public int getAnnotationWidth()- Returns:
- The width of the right side containing the annotations
-
writeAnnotations
Writes the annotated content of this instance to the given writer.- Parameters:
out- non-null; where to write to- Throws:
IOException
-
setLimit
public void setLimit(int start, int end) -
clearLimit
public void clearLimit()
-