Package org.jf.dexlib2.writer
Class DexWriter<StringKey extends java.lang.CharSequence,StringRef extends StringReference,TypeKey extends java.lang.CharSequence,TypeRef extends TypeReference,ProtoRefKey extends MethodProtoReference,FieldRefKey extends FieldReference,MethodRefKey extends MethodReference,ClassKey extends java.lang.Comparable<? super ClassKey>,CallSiteKey extends CallSiteReference,MethodHandleKey extends MethodHandleReference,AnnotationKey extends Annotation,AnnotationSetKey,TypeListKey,FieldKey,MethodKey,EncodedArrayKey,EncodedValue,AnnotationElement extends AnnotationElement,StringSectionType extends StringSection<StringKey,StringRef>,TypeSectionType extends TypeSection<StringKey,TypeKey,TypeRef>,ProtoSectionType extends ProtoSection<StringKey,TypeKey,ProtoRefKey,TypeListKey>,FieldSectionType extends FieldSection<StringKey,TypeKey,FieldRefKey,FieldKey>,MethodSectionType extends MethodSection<StringKey,TypeKey,ProtoRefKey,MethodRefKey,MethodKey>,ClassSectionType extends ClassSection<StringKey,TypeKey,TypeListKey,ClassKey,FieldKey,MethodKey,AnnotationSetKey,EncodedArrayKey>,CallSiteSectionType extends CallSiteSection<CallSiteKey,EncodedArrayKey>,MethodHandleSectionType extends MethodHandleSection<MethodHandleKey,FieldRefKey,MethodRefKey>,TypeListSectionType extends TypeListSection<TypeKey,TypeListKey>,AnnotationSectionType extends AnnotationSection<StringKey,TypeKey,AnnotationKey,AnnotationElement,EncodedValue>,AnnotationSetSectionType extends AnnotationSetSection<AnnotationKey,AnnotationSetKey>,EncodedArraySectionType extends EncodedArraySection<EncodedArrayKey,EncodedValue>>
- java.lang.Object
-
- org.jf.dexlib2.writer.DexWriter<StringKey,StringRef,TypeKey,TypeRef,ProtoRefKey,FieldRefKey,MethodRefKey,ClassKey,CallSiteKey,MethodHandleKey,AnnotationKey,AnnotationSetKey,TypeListKey,FieldKey,MethodKey,EncodedArrayKey,EncodedValue,AnnotationElement,StringSectionType,TypeSectionType,ProtoSectionType,FieldSectionType,MethodSectionType,ClassSectionType,CallSiteSectionType,MethodHandleSectionType,TypeListSectionType,AnnotationSectionType,AnnotationSetSectionType,EncodedArraySectionType>
-
- Direct Known Subclasses:
DexBuilder
,DexPool
public abstract class DexWriter<StringKey extends java.lang.CharSequence,StringRef extends StringReference,TypeKey extends java.lang.CharSequence,TypeRef extends TypeReference,ProtoRefKey extends MethodProtoReference,FieldRefKey extends FieldReference,MethodRefKey extends MethodReference,ClassKey extends java.lang.Comparable<? super ClassKey>,CallSiteKey extends CallSiteReference,MethodHandleKey extends MethodHandleReference,AnnotationKey extends Annotation,AnnotationSetKey,TypeListKey,FieldKey,MethodKey,EncodedArrayKey,EncodedValue,AnnotationElement extends AnnotationElement,StringSectionType extends StringSection<StringKey,StringRef>,TypeSectionType extends TypeSection<StringKey,TypeKey,TypeRef>,ProtoSectionType extends ProtoSection<StringKey,TypeKey,ProtoRefKey,TypeListKey>,FieldSectionType extends FieldSection<StringKey,TypeKey,FieldRefKey,FieldKey>,MethodSectionType extends MethodSection<StringKey,TypeKey,ProtoRefKey,MethodRefKey,MethodKey>,ClassSectionType extends ClassSection<StringKey,TypeKey,TypeListKey,ClassKey,FieldKey,MethodKey,AnnotationSetKey,EncodedArrayKey>,CallSiteSectionType extends CallSiteSection<CallSiteKey,EncodedArrayKey>,MethodHandleSectionType extends MethodHandleSection<MethodHandleKey,FieldRefKey,MethodRefKey>,TypeListSectionType extends TypeListSection<TypeKey,TypeListKey>,AnnotationSectionType extends AnnotationSection<StringKey,TypeKey,AnnotationKey,AnnotationElement,EncodedValue>,AnnotationSetSectionType extends AnnotationSetSection<AnnotationKey,AnnotationSetKey>,EncodedArraySectionType extends EncodedArraySection<EncodedArrayKey,EncodedValue>> extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
DexWriter.InternalEncodedValueWriter
class
DexWriter.SectionProvider
-
Field Summary
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.String>
getFieldReferences()
java.util.List<java.lang.String>
getMethodReferences()
protected abstract DexWriter.SectionProvider
getSectionProvider()
java.util.List<java.lang.String>
getTypeReferences()
boolean
hasOverflowed()
Checks whether any of the size-sensitive constant pools have overflowed and have more than 64Ki entries.boolean
hasOverflowed(int maxPoolSize)
Checks whether any of the size-sensitive constant pools have more than the supplied maximum number of entries.protected abstract void
writeEncodedValue(DexWriter.InternalEncodedValueWriter writer, EncodedValue encodedValue)
void
writeTo(DexDataStore dest)
void
writeTo(DexDataStore dest, DeferredOutputStreamFactory tempFactory)
-
-
-
Field Detail
-
NO_INDEX
public static final int NO_INDEX
- See Also:
- Constant Field Values
-
NO_OFFSET
public static final int NO_OFFSET
- See Also:
- Constant Field Values
-
MAX_POOL_SIZE
public static final int MAX_POOL_SIZE
- See Also:
- Constant Field Values
-
opcodes
protected final Opcodes opcodes
-
stringIndexSectionOffset
protected int stringIndexSectionOffset
-
typeSectionOffset
protected int typeSectionOffset
-
protoSectionOffset
protected int protoSectionOffset
-
fieldSectionOffset
protected int fieldSectionOffset
-
methodSectionOffset
protected int methodSectionOffset
-
classIndexSectionOffset
protected int classIndexSectionOffset
-
callSiteSectionOffset
protected int callSiteSectionOffset
-
methodHandleSectionOffset
protected int methodHandleSectionOffset
-
stringDataSectionOffset
protected int stringDataSectionOffset
-
classDataSectionOffset
protected int classDataSectionOffset
-
typeListSectionOffset
protected int typeListSectionOffset
-
encodedArraySectionOffset
protected int encodedArraySectionOffset
-
annotationSectionOffset
protected int annotationSectionOffset
-
annotationSetSectionOffset
protected int annotationSetSectionOffset
-
annotationSetRefSectionOffset
protected int annotationSetRefSectionOffset
-
annotationDirectorySectionOffset
protected int annotationDirectorySectionOffset
-
debugSectionOffset
protected int debugSectionOffset
-
codeSectionOffset
protected int codeSectionOffset
-
hiddenApiRestrictionsOffset
protected int hiddenApiRestrictionsOffset
-
mapSectionOffset
protected int mapSectionOffset
-
hasHiddenApiRestrictions
protected boolean hasHiddenApiRestrictions
-
numAnnotationSetRefItems
protected int numAnnotationSetRefItems
-
numAnnotationDirectoryItems
protected int numAnnotationDirectoryItems
-
numDebugInfoItems
protected int numDebugInfoItems
-
numCodeItemItems
protected int numCodeItemItems
-
numClassDataItems
protected int numClassDataItems
-
stringSection
public final StringSectionType extends StringSection<StringKey,StringRef> stringSection
-
typeSection
public final TypeSectionType extends TypeSection<StringKey,TypeKey,TypeRef> typeSection
-
protoSection
public final ProtoSectionType extends ProtoSection<StringKey,TypeKey,ProtoRefKey,TypeListKey> protoSection
-
fieldSection
public final FieldSectionType extends FieldSection<StringKey,TypeKey,FieldRefKey,FieldKey> fieldSection
-
methodSection
public final MethodSectionType extends MethodSection<StringKey,TypeKey,ProtoRefKey,MethodRefKey,MethodKey> methodSection
-
classSection
public final ClassSectionType extends ClassSection<StringKey,TypeKey,TypeListKey,ClassKey,FieldKey,MethodKey,AnnotationSetKey,EncodedArrayKey> classSection
-
callSiteSection
public final CallSiteSectionType extends CallSiteSection<CallSiteKey,EncodedArrayKey> callSiteSection
-
methodHandleSection
public final MethodHandleSectionType extends MethodHandleSection<MethodHandleKey,FieldRefKey,MethodRefKey> methodHandleSection
-
typeListSection
public final TypeListSectionType extends TypeListSection<TypeKey,TypeListKey> typeListSection
-
annotationSection
public final AnnotationSectionType extends AnnotationSection<StringKey,TypeKey,AnnotationKey,AnnotationElement,EncodedValue> annotationSection
-
annotationSetSection
public final AnnotationSetSectionType extends AnnotationSetSection<AnnotationKey,AnnotationSetKey> annotationSetSection
-
encodedArraySection
public final EncodedArraySectionType extends EncodedArraySection<EncodedArrayKey,EncodedValue> encodedArraySection
-
-
Constructor Detail
-
DexWriter
protected DexWriter(Opcodes opcodes)
-
-
Method Detail
-
getSectionProvider
@Nonnull protected abstract DexWriter.SectionProvider getSectionProvider()
-
writeEncodedValue
protected abstract void writeEncodedValue(@Nonnull DexWriter.InternalEncodedValueWriter writer, @Nonnull EncodedValue encodedValue) throws java.io.IOException
- Throws:
java.io.IOException
-
getMethodReferences
@Nonnull public java.util.List<java.lang.String> getMethodReferences()
-
getFieldReferences
@Nonnull public java.util.List<java.lang.String> getFieldReferences()
-
getTypeReferences
@Nonnull public java.util.List<java.lang.String> getTypeReferences()
-
hasOverflowed
public boolean hasOverflowed()
Checks whether any of the size-sensitive constant pools have overflowed and have more than 64Ki entries. Note that even if this returns true, it may still be possible to successfully write the dex file, if the overflowed items are not referenced anywhere that uses a 16-bit index.- Returns:
- true if any of the size-sensitive constant pools have overflowed
-
hasOverflowed
public boolean hasOverflowed(int maxPoolSize)
Checks whether any of the size-sensitive constant pools have more than the supplied maximum number of entries.- Parameters:
maxPoolSize
- the maximum number of entries allowed in any of the size-sensitive constant pools- Returns:
- true if any of the size-sensitive constant pools have overflowed the supplied size limit
-
writeTo
public void writeTo(@Nonnull DexDataStore dest) throws java.io.IOException
- Throws:
java.io.IOException
-
writeTo
public void writeTo(@Nonnull DexDataStore dest, @Nonnull DeferredOutputStreamFactory tempFactory) throws java.io.IOException
- Throws:
java.io.IOException
-
-