Package com.adobe.internal.mac.resource
Class ResourceParser
java.lang.Object
com.adobe.internal.mac.resource.ResourceParser
A general framework for parsing Mac resource files. The location of the resource (data fork,
resource fork, or other) doesn't matter as long the full location of the resource is given.
This resource parser will read the basic structure of the resource (see
http://developer.apple.com/documentation/mac/MoreToolbox/MoreToolbox-99.html for Apple's Resource File Format})
and will call back to handlers for each type of resource (e.g. 'FOND', 'sfnt', 'DITL', etc.) that are
provided to the parser.
Because Resource files are non-linear and the I/O interface is linear (a stream) the parsing is done in a
two pass process. In the first pass the parser collects data about all of the individual resources in the
Resource file. In the second pass the handlers for each resource type are called as the resources
occur in the stream.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classInformation about a specific resource.static interfaceThe interface that a callback resource handler must support. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHandler(ResourceParser.ResourceHandler handler) Adds a resource handler to the parser.voidparse()Parse the Resource file.voidSet the URL for the resource file to be parsed.
-
Constructor Details
-
ResourceParser
public ResourceParser()Constructor. This parser can be reused to parse multiple Resource files.
-
-
Method Details
-
setURL
Set the URL for the resource file to be parsed.- Parameters:
url- location of the resource data
-
addHandler
Adds a resource handler to the parser. If a handler for that resource type has already been added then it is removed and the one being added replaces it.- Parameters:
handler- a handler for a specific resource type
-
parse
Parse the Resource file.- Throws:
IOException
-