public final class SymbolIo
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ANDROID_ATTR_PREFIX |
Modifier and Type | Method and Description |
---|---|
static java.io.File |
exportToJava(com.android.builder.symbols.SymbolTable table,
java.io.File directory,
boolean finalIds)
Exports a symbol table to a java
R class source. |
static com.android.builder.symbols.SymbolTable |
read(java.io.File file,
java.lang.String tablePackage)
Loads a symbol table from a symbol file.
|
static com.android.builder.symbols.SymbolTable |
readFromAapt(java.io.File file,
java.lang.String tablePackage)
Loads a symbol table from a symbol file created by aapt
|
static com.android.builder.symbols.SymbolTable |
readTableWithPackage(java.io.File file)
Loads a symbol table from a synthetic namespaced symbol file.
|
static com.android.builder.symbols.SymbolTable |
readTableWithPackage(java.nio.file.Path file) |
static void |
write(com.android.builder.symbols.SymbolTable table,
java.io.File file)
Writes a symbol table to a symbol file.
|
static void |
write(com.android.builder.symbols.SymbolTable table,
java.nio.file.Path file) |
static void |
writeSymbolTableWithPackage(java.nio.file.Path symbolTable,
java.nio.file.Path manifest,
java.nio.file.Path outputFile)
Writes the symbol table with the package name as the first line.
|
public static final java.lang.String ANDROID_ATTR_PREFIX
@NonNull public static com.android.builder.symbols.SymbolTable read(@NonNull java.io.File file, @Nullable java.lang.String tablePackage) throws java.io.IOException
file
- the symbol filetablePackage
- the package name associated with the tablejava.io.IOException
- failed to read the table@NonNull public static com.android.builder.symbols.SymbolTable readFromAapt(@NonNull java.io.File file, @Nullable java.lang.String tablePackage) throws java.io.IOException
file
- the symbol filetablePackage
- the package name associated with the tablejava.io.IOException
- failed to read the table@NonNull public static com.android.builder.symbols.SymbolTable readTableWithPackage(@NonNull java.io.File file) throws java.io.IOException
This is just a symbol table, but with the addition of the table package as the first line.
file
- the symbol filejava.io.IOException
- failed to read the table@NonNull public static com.android.builder.symbols.SymbolTable readTableWithPackage(@NonNull java.nio.file.Path file) throws java.io.IOException
java.io.IOException
public static void write(@NonNull com.android.builder.symbols.SymbolTable table, @NonNull java.io.File file)
table
- the tablefile
- the file where the table should be writtenjava.io.UncheckedIOException
- I/O errorpublic static void write(@NonNull com.android.builder.symbols.SymbolTable table, @NonNull java.nio.file.Path file)
public static void writeSymbolTableWithPackage(@NonNull java.nio.file.Path symbolTable, @NonNull java.nio.file.Path manifest, @NonNull java.nio.file.Path outputFile) throws java.io.IOException
symbolTable
- The R.txt file. If it does not exist, the result will be a file containing
only the package namemanifest
- The AndroidManifest.xml file for this library. The package name is extracted
and written as the first line of the output.outputFile
- The file to write the result to.java.io.IOException
@NonNull public static java.io.File exportToJava(@NonNull com.android.builder.symbols.SymbolTable table, @NonNull java.io.File directory, boolean finalIds)
R
class source. This method will create the source
file and any necessary directories. For example, if the package is a.b
and the class
name is RR
, this method will generate a file called RR.java
in directory
directory/a/b
creating directories a
and b
if necessary.table
- the table to exportdirectory
- the directory where the R source should be generatedfinalIds
- should the generated IDs be final?java.io.UncheckedIOException
- failed to generate the source