public interface DexArchive
extends java.io.Closeable
Dex archives can be updated by adding new files, or removing existing ones.
When using instances of DexArchive make sure that you invoke Closeable.close() after
you are done using it.
| Modifier and Type | Method and Description |
|---|---|
void |
addFile(java.nio.file.Path relativePath,
byte[] bytes,
int offset,
int end)
Adds a DEX file to this dex archive from a byte[].
|
void |
addFile(java.nio.file.Path relativePath,
java.io.InputStream inputStream)
Adds a DEX file to this dex archive.
|
java.util.List<DexArchiveEntry> |
getFiles()
Returns collection of all entries,
DexArchiveEntry, in this dex archive. |
java.nio.file.Path |
getRootPath()
Returns the path to this DEX archive.
|
void |
removeFile(java.nio.file.Path relativePath)
Removes the specified DEX file from the dex archive.
|
@NonNull java.nio.file.Path getRootPath()
void addFile(@NonNull
java.nio.file.Path relativePath,
@NonNull
java.io.InputStream inputStream)
throws java.io.IOException
getRootPath(). In case file with the same relative path already exists, implementations of
this method should overwrite it with the new version of the file.relativePath - file to be added to this archiveinputStream - data to writejava.io.IOExceptionvoid addFile(@NonNull
java.nio.file.Path relativePath,
byte[] bytes,
int offset,
int end)
throws java.io.IOException
getRootPath(). In case file with the same relative path already exists, implementations of
this method should overwrite it with the new version of the file.relativePath - file to be added to this archivebytes - the buffer to get the dex file content fromoffset - the offset for the buffer window.end - the end of the buffer window.java.io.IOException - if the dex file cannot be written.void removeFile(@NonNull
java.nio.file.Path relativePath)
throws java.io.IOException
relativePath - file to be removed from the dex archive, relative to the getRootPath()java.io.IOException@NonNull java.util.List<DexArchiveEntry> getFiles() throws java.io.IOException
DexArchiveEntry, in this dex archive. The entries
contain information about the relative path, DexArchiveEntry.getRelativePathInArchive() as well as the actual DEX file content, DexArchiveEntry.getDexFileContent().java.io.IOException