ContentHandlerFactory
Stay organized with collections
Save and categorize content based on your preferences.
This interface defines a factory for content handlers. An
implementation of this interface should map a MIME type into an
instance of ContentHandler
.
This interface is used by the URLStreamHandler
class
to create a ContentHandler
for a MIME type.
Public Methods
public
abstract
ContentHandler
createContentHandler
(String mimetype)
Creates a new ContentHandler
to read an object from
a URLStreamHandler
.
Parameters
mimetype |
the MIME type for which a content handler is desired. |
Returns
- a new
ContentHandler
to read an object from a
URLStreamHandler
.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eContentHandlerFactory\u003c/code\u003e is an interface that defines a factory for creating \u003ccode\u003eContentHandler\u003c/code\u003e instances based on MIME types.\u003c/p\u003e\n"],["\u003cp\u003eImplementations map a MIME type to a corresponding \u003ccode\u003eContentHandler\u003c/code\u003e for handling specific content types.\u003c/p\u003e\n"],["\u003cp\u003eIt's primarily used by \u003ccode\u003eURLStreamHandler\u003c/code\u003e to obtain the appropriate \u003ccode\u003eContentHandler\u003c/code\u003e for reading data from a URL.\u003c/p\u003e\n"],["\u003cp\u003eThe core method, \u003ccode\u003ecreateContentHandler(String mimetype)\u003c/code\u003e, returns a new \u003ccode\u003eContentHandler\u003c/code\u003e instance based on the provided MIME type.\u003c/p\u003e\n"]]],["The `ContentHandlerFactory` interface maps MIME types to `ContentHandler` instances. Its primary function is fulfilled by the `createContentHandler` method. This method accepts a MIME type string as input and returns a new `ContentHandler` object. The `ContentHandler` is then used by a `URLStreamHandler` to read data associated with that specific MIME type. This factory provides a way to create handlers tailored to different content types fetched from a URL.\n"],null,["# ContentHandlerFactory\n\npublic interface **ContentHandlerFactory** \nThis interface defines a factory for content handlers. An\nimplementation of this interface should map a MIME type into an\ninstance of `ContentHandler`.\n\n\nThis interface is used by the `URLStreamHandler` class\nto create a `ContentHandler` for a MIME type. \n\n##### See Also\n\n- [ContentHandler](../../../reference/java/net/ContentHandler.html)\n- [URLStreamHandler](../../../reference/java/net/URLStreamHandler.html) \n\n### Public Method Summary\n\n|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [ContentHandler](../../../reference/java/net/ContentHandler.html) | [createContentHandler](../../../reference/java/net/ContentHandlerFactory.html#createContentHandler(java.lang.String))([String](../../../reference/java/lang/String.html) mimetype) Creates a new `ContentHandler` to read an object from a `URLStreamHandler`. |\n\nPublic Methods\n--------------\n\n#### public abstract [ContentHandler](../../../reference/java/net/ContentHandler.html)\n**createContentHandler**\n([String](../../../reference/java/lang/String.html) mimetype)\n\nCreates a new `ContentHandler` to read an object from\na `URLStreamHandler`. \n\n##### Parameters\n\n| mimetype | the MIME type for which a content handler is desired. |\n|----------|-------------------------------------------------------|\n\n##### Returns\n\n- a new `ContentHandler` to read an object from a `URLStreamHandler`. \n\n##### See Also\n\n- [ContentHandler](../../../reference/java/net/ContentHandler.html)\n- [URLStreamHandler](../../../reference/java/net/URLStreamHandler.html)"]]