Package org.jf.dexlib2.util
Class AnnotatedBytes
- java.lang.Object
-
- org.jf.dexlib2.util.AnnotatedBytes
-
- Direct Known Subclasses:
DexAnnotator
public class AnnotatedBytes extends java.lang.Object
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.
-
-
Constructor Summary
Constructors Constructor Description AnnotatedBytes(int width)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
annotate(int length, java.lang.String msg, java.lang.Object... formatArgs)
Add an annotation of the given length at the current location.void
annotateTo(int offset, java.lang.String msg, java.lang.Object... formatArgs)
void
clearLimit()
void
deindent()
int
getAnnotationWidth()
int
getCursor()
void
indent()
void
moveBy(int offset)
Moves the cursor forward or backward by some amountvoid
moveTo(int offset)
Moves the cursor to a new locationvoid
setLimit(int start, int end)
void
writeAnnotations(java.io.Writer out, byte[] data, int offset)
Writes the annotated content of this instance to the given writer.
-
-
-
Method Detail
-
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
public void annotateTo(int offset, @Nonnull java.lang.String msg, java.lang.Object... formatArgs)
-
annotate
public void annotate(int length, @Nonnull java.lang.String msg, java.lang.Object... formatArgs)
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
-
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
public void writeAnnotations(java.io.Writer out, byte[] data, int offset) throws java.io.IOException
Writes the annotated content of this instance to the given writer.- Parameters:
out
- non-null; where to write to- Throws:
java.io.IOException
-
setLimit
public void setLimit(int start, int end)
-
clearLimit
public void clearLimit()
-
-