Package com.adobe.internal.mac.resource
Class ResourceParser
- java.lang.Object
-
- com.adobe.internal.mac.resource.ResourceParser
-
public class ResourceParser extends java.lang.Object
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 Classes Modifier and Type Class Description static class
ResourceParser.ResourceEntry
Information about a specific resource.static interface
ResourceParser.ResourceHandler
The interface that a callback resource handler must support.
-
Constructor Summary
Constructors Constructor Description ResourceParser()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHandler(ResourceParser.ResourceHandler handler)
Adds a resource handler to the parser.void
parse()
Parse the Resource file.void
setURL(java.net.URL url)
Set the URL for the resource file to be parsed.
-
-
-
Method Detail
-
setURL
public void setURL(java.net.URL url)
Set the URL for the resource file to be parsed.- Parameters:
url
- location of the resource data
-
addHandler
public void addHandler(ResourceParser.ResourceHandler handler)
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
public void parse() throws java.io.IOException
Parse the Resource file.- Throws:
java.io.IOException
-
-