com.android.ide.common.resources
Class IdResourceParser
java.lang.Object
com.android.ide.common.resources.IdResourceParser
public class IdResourceParser
- extends java.lang.Object
Parser for scanning an id-generating resource file such as a layout or a menu
file, which registers any ids it encounters with an
ValueResourceParser.IValueResourceRepository
, and which registers errors with a
ScanningContext
.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IdResourceParser
public IdResourceParser(@NonNull
ValueResourceParser.IValueResourceRepository repository,
@NonNull
ScanningContext context,
boolean isFramework)
- Creates a new
IdResourceParser
- Parameters:
repository
- value repository for registering resource declarationcontext
- a context object with state for the current update, such
as a place to stash errors encounteredisFramework
- true if scanning a framework resource
parse
public boolean parse(com.android.resources.ResourceType type,
java.lang.String path,
java.io.InputStream input)
throws java.io.IOException
- Parse the given input and register ids with the given
ValueResourceParser.IValueResourceRepository
.
- Parameters:
type
- the type of resource being scannedpath
- the full OS path to the file being parsedinput
- the input stream of the XML to be parsed (will be closed by this method)
- Returns:
- true if parsing succeeds and false if it fails
- Throws:
java.io.IOException
- if reading the contents fails