DexPatcher / multidexlib2

Multi-dex extensions for dexlib2
https://dexpatcher.github.io/
GNU General Public License v3.0
68 stars 34 forks source link

[Feature] Ability to use byte array or Input/Output Streams #1

Closed miuirussia closed 7 years ago

Lanchon commented 7 years ago

hi,

you'll have to tell me more about what you want to achieve and why you need this.

single ("raw") dex I/O

there is limited support for dex reads from byte array and streams in RawDexIO:

public static DexBackedDexFile readRawDexFile(InputStream inputStream, long expectedSize, Opcodes opcodes) throws IOException
public static DexBackedDexFile readRawDexFile(byte[] buf, int offset, Opcodes opcodes) throws IOException

but there is no corresponding support for dex writes. the reason is: dexlib2 already does this. there is nothing to add, no Opcodes autodetection is applicable, so why replicate this interface? dexlib2 natively writes to streams, so byte arrays should be handled as byte array-backed output streams.

granted, RawDexIO could write to streams, but only as convenience methods to make the API more symmetric.

multi-dex

the focus of multidexlib2 is clearly files. for multidex, it could instead operate on:

clearly the factories of streams would be the underlying implementation of everything.

so...

the problems with this proposal are:

so you need to talk me into doing this by convincing me of why it is important and what there is to gain.

thanks!