Package org.jf.baksmali.formatter
Class BaksmaliWriter
- java.lang.Object
-
- java.io.Writer
-
- org.jf.dexlib2.formatter.DexFormattedWriter
-
- org.jf.baksmali.formatter.BaksmaliWriter
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.Appendable,java.lang.AutoCloseable
public class BaksmaliWriter extends org.jf.dexlib2.formatter.DexFormattedWriterA specialized version of DexFormattedWriter that handles quoting simple names containing spaces.
-
-
Field Summary
Fields Modifier and Type Field Description protected char[]buffer
-
Constructor Summary
Constructors Constructor Description BaksmaliWriter(java.io.Writer writer)BaksmaliWriter(java.io.Writer writer, java.lang.String classContext)Constructs a new BaksmaliWriter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeindent(int indentAmount)voidindent(int indentAmount)org.jf.util.IndentingWriterindentingWriter()protected voidwriteAnnotation(org.jf.dexlib2.iface.value.AnnotationEncodedValue annotation)Write the givenAnnotationEncodedValue.voidwriteAnnotationElements(java.util.Collection<? extends org.jf.dexlib2.iface.AnnotationElement> annotationElements)protected voidwriteArray(org.jf.dexlib2.iface.value.ArrayEncodedValue array)Write the givenArrayEncodedValue.protected voidwriteBooleanEncodedValue(org.jf.dexlib2.iface.value.BooleanEncodedValue encodedValue)voidwriteCallSite(org.jf.dexlib2.iface.reference.CallSiteReference callSiteReference)protected voidwriteCharEncodedValue(org.jf.dexlib2.iface.value.CharEncodedValue encodedValue)protected voidwriteClass(java.lang.CharSequence type)protected voidwriteDoubleEncodedValue(org.jf.dexlib2.iface.value.DoubleEncodedValue encodedValue)voidwriteEncodedValue(org.jf.dexlib2.iface.value.EncodedValue encodedValue)protected voidwriteEnum(org.jf.dexlib2.iface.value.EnumEncodedValue encodedValue)voidwriteFieldDescriptor(org.jf.dexlib2.iface.reference.FieldReference fieldReference)protected voidwriteFloatEncodedValue(org.jf.dexlib2.iface.value.FloatEncodedValue encodedValue)protected voidwriteIntegralValue(long value, java.lang.Character suffix)voidwriteMethodDescriptor(org.jf.dexlib2.iface.reference.MethodReference methodReference)voidwriteSignedIntAsDec(int value)voidwriteSignedIntOrLongTo(long val)voidwriteSignedLongAsDec(long value)voidwriteSimpleName(java.lang.CharSequence simpleName)voidwriteSimpleName(java.lang.CharSequence simpleName, boolean quoted)Writes the given simple name, potentially quoting it if requested.voidwriteUnsignedIntAsDec(int value)voidwriteUnsignedLongAsHex(long value)
-
-
-
Constructor Detail
-
BaksmaliWriter
public BaksmaliWriter(java.io.Writer writer)
-
BaksmaliWriter
public BaksmaliWriter(java.io.Writer writer, @Nullable java.lang.String classContext)Constructs a new BaksmaliWriter- Parameters:
writer- TheIndentingWriterto write toclassContext- If provided, the class will be elided from any field/method descriptors whose containing class match this instance's classContext.
-
-
Method Detail
-
writeMethodDescriptor
public void writeMethodDescriptor(org.jf.dexlib2.iface.reference.MethodReference methodReference) throws java.io.IOException- Overrides:
writeMethodDescriptorin classorg.jf.dexlib2.formatter.DexFormattedWriter- Throws:
java.io.IOException
-
writeFieldDescriptor
public void writeFieldDescriptor(org.jf.dexlib2.iface.reference.FieldReference fieldReference) throws java.io.IOException- Overrides:
writeFieldDescriptorin classorg.jf.dexlib2.formatter.DexFormattedWriter- Throws:
java.io.IOException
-
writeClass
protected void writeClass(java.lang.CharSequence type) throws java.io.IOException- Overrides:
writeClassin classorg.jf.dexlib2.formatter.DexFormattedWriter- Throws:
java.io.IOException
-
writeSimpleName
public void writeSimpleName(java.lang.CharSequence simpleName) throws java.io.IOException- Overrides:
writeSimpleNamein classorg.jf.dexlib2.formatter.DexFormattedWriter- Throws:
java.io.IOException
-
writeSimpleName
public void writeSimpleName(java.lang.CharSequence simpleName, boolean quoted) throws java.io.IOExceptionWrites the given simple name, potentially quoting it if requested.The simple name will be quoted with backticks if quoted is true
A simple name should typically be quoted if it is meant to be human readable, and it contains spaces.
- Parameters:
simpleName- The simple name to write. See: https://source.android.com/devices/tech/dalvik/dex-format#simplename- Throws:
java.io.IOException
-
writeEncodedValue
public void writeEncodedValue(org.jf.dexlib2.iface.value.EncodedValue encodedValue) throws java.io.IOException- Overrides:
writeEncodedValuein classorg.jf.dexlib2.formatter.DexFormattedWriter- Throws:
java.io.IOException
-
writeBooleanEncodedValue
protected void writeBooleanEncodedValue(org.jf.dexlib2.iface.value.BooleanEncodedValue encodedValue) throws java.io.IOException- Throws:
java.io.IOException
-
writeIntegralValue
protected void writeIntegralValue(long value, @Nullable java.lang.Character suffix) throws java.io.IOException- Throws:
java.io.IOException
-
writeCharEncodedValue
protected void writeCharEncodedValue(org.jf.dexlib2.iface.value.CharEncodedValue encodedValue) throws java.io.IOException- Throws:
java.io.IOException
-
writeFloatEncodedValue
protected void writeFloatEncodedValue(org.jf.dexlib2.iface.value.FloatEncodedValue encodedValue) throws java.io.IOException- Throws:
java.io.IOException
-
writeDoubleEncodedValue
protected void writeDoubleEncodedValue(org.jf.dexlib2.iface.value.DoubleEncodedValue encodedValue) throws java.io.IOException- Throws:
java.io.IOException
-
writeEnum
protected void writeEnum(org.jf.dexlib2.iface.value.EnumEncodedValue encodedValue) throws java.io.IOException- Throws:
java.io.IOException
-
writeAnnotation
protected void writeAnnotation(org.jf.dexlib2.iface.value.AnnotationEncodedValue annotation) throws java.io.IOExceptionWrite the givenAnnotationEncodedValue.- Overrides:
writeAnnotationin classorg.jf.dexlib2.formatter.DexFormattedWriter- Throws:
java.io.IOException
-
writeAnnotationElements
public void writeAnnotationElements(@Nonnull java.util.Collection<? extends org.jf.dexlib2.iface.AnnotationElement> annotationElements) throws java.io.IOException- Throws:
java.io.IOException
-
writeArray
protected void writeArray(org.jf.dexlib2.iface.value.ArrayEncodedValue array) throws java.io.IOExceptionWrite the givenArrayEncodedValue.- Overrides:
writeArrayin classorg.jf.dexlib2.formatter.DexFormattedWriter- Throws:
java.io.IOException
-
writeCallSite
public void writeCallSite(org.jf.dexlib2.iface.reference.CallSiteReference callSiteReference) throws java.io.IOException- Overrides:
writeCallSitein classorg.jf.dexlib2.formatter.DexFormattedWriter- Throws:
java.io.IOException
-
indentingWriter
public org.jf.util.IndentingWriter indentingWriter()
-
writeUnsignedLongAsHex
public void writeUnsignedLongAsHex(long value) throws java.io.IOException- Throws:
java.io.IOException
-
writeSignedLongAsDec
public void writeSignedLongAsDec(long value) throws java.io.IOException- Throws:
java.io.IOException
-
writeSignedIntAsDec
public void writeSignedIntAsDec(int value) throws java.io.IOException- Throws:
java.io.IOException
-
writeUnsignedIntAsDec
public void writeUnsignedIntAsDec(int value) throws java.io.IOException- Throws:
java.io.IOException
-
writeSignedIntOrLongTo
public void writeSignedIntOrLongTo(long val) throws java.io.IOException- Throws:
java.io.IOException
-
indent
public void indent(int indentAmount)
-
deindent
public void deindent(int indentAmount)
-
-