Package com.android.dx.dex.file
Class ValueEncoder
java.lang.Object
com.android.dx.dex.file.ValueEncoder
Handler for writing out
encoded_values
and parts
thereof.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addContents
(DexFile file, Annotation annotation) Helper foraddContents()
methods, which adds contents for a particularAnnotation
, calling itself recursively should it encounter a nested annotation.static void
addContents
(DexFile file, Constant cst) Helper foraddContents()
methods, which adds contents for a particular constant, calling itself recursively should it encounter aCstArray
and callingaddContents(DexFile,Annotation)
recursively should it encounter aCstAnnotation
.static String
constantToHuman
(Constant cst) Gets the colloquial type name and human form of the type of the given constant, when used as an encoded value.void
writeAnnotation
(Annotation annotation, boolean topLevel) Writes out the encoded form of the given annotation, that is, as anencoded_annotation
and not including avalue_type
prefix.void
writeArray
(CstArray array, boolean topLevel) Writes out the encoded form of the given array, that is, as anencoded_array
and not including avalue_type
prefix.void
writeConstant
(Constant cst) Writes out the encoded form of the given constant.
-
Constructor Details
-
Method Details
-
writeConstant
Writes out the encoded form of the given constant.- Parameters:
cst
-non-null;
the constant to write
-
writeArray
Writes out the encoded form of the given array, that is, as anencoded_array
and not including avalue_type
prefix. If the output stream keeps (debugging) annotations andtopLevel
istrue
, then this method will write (debugging) annotations.- Parameters:
array
-non-null;
array instance to writetopLevel
-true
iff the given annotation is the top-level annotation orfalse
if it is a sub-annotation of some other annotation
-
writeAnnotation
Writes out the encoded form of the given annotation, that is, as anencoded_annotation
and not including avalue_type
prefix. If the output stream keeps (debugging) annotations andtopLevel
istrue
, then this method will write (debugging) annotations.- Parameters:
annotation
-non-null;
annotation instance to writetopLevel
-true
iff the given annotation is the top-level annotation orfalse
if it is a sub-annotation of some other annotation
-
constantToHuman
Gets the colloquial type name and human form of the type of the given constant, when used as an encoded value.- Parameters:
cst
-non-null;
the constant- Returns:
non-null;
its type name and human form
-
addContents
Helper foraddContents()
methods, which adds contents for a particularAnnotation
, calling itself recursively should it encounter a nested annotation.- Parameters:
file
-non-null;
the file to add toannotation
-non-null;
the annotation to add contents for
-
addContents
Helper foraddContents()
methods, which adds contents for a particular constant, calling itself recursively should it encounter aCstArray
and callingaddContents(DexFile,Annotation)
recursively should it encounter aCstAnnotation
.- Parameters:
file
-non-null;
the file to add tocst
-non-null;
the constant to add contents for
-