Class DefaultCloudFontConnector
- java.lang.Object
-
- ca.cgjennings.graphics.cloudfonts.DefaultCloudFontConnector
-
- All Implemented Interfaces:
CloudFontConnector
public class DefaultCloudFontConnector extends java.lang.Object implements CloudFontConnector
The connector used to implementCloudFonts.getDefaultCollection().
-
-
Constructor Summary
Constructors Constructor Description DefaultCloudFontConnector()DefaultCloudFontConnector(java.lang.String identifier, java.lang.String cacheName, java.lang.String fontBaseUrl, java.lang.String metadataUrl)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CloudFontCollectioncreateFontCollection()Creates a collection that will use this connector's connection details.java.lang.StringgetIdentifier()Returns a unique identifier for the connector.java.io.FilegetLocalCacheRoot()Returns the root directory of the local cache.java.net.URLgetUrlForFontPath(java.lang.String fontPath)Given a path to a font resource relative to the cloud file system root, returns a URL that can be used to download the resource.java.net.URLgetUrlForMetadata()Returns a URL for metadata that describes the available fonts.java.net.URLgetUrlForMetadataVersion()Returns a URL that returns a version code for the font metadata.
-
-
-
Method Detail
-
getIdentifier
public java.lang.String getIdentifier()
Description copied from interface:CloudFontConnectorReturns a unique identifier for the connector. This can be used to distinguish data from different connectors, for example, when storing settings.- Specified by:
getIdentifierin interfaceCloudFontConnector- Returns:
- a unique identifier for the connector
-
getUrlForFontPath
public java.net.URL getUrlForFontPath(java.lang.String fontPath)
Description copied from interface:CloudFontConnectorGiven a path to a font resource relative to the cloud file system root, returns a URL that can be used to download the resource.- Specified by:
getUrlForFontPathin interfaceCloudFontConnector- Parameters:
fontPath- a path to a font resource, such as"ofl/lobster/Lobster-Regular.ttf"- Returns:
- a URL that can be used to download the resource
-
getUrlForMetadata
public java.net.URL getUrlForMetadata()
Description copied from interface:CloudFontConnectorReturns a URL for metadata that describes the available fonts.- Specified by:
getUrlForMetadatain interfaceCloudFontConnector- Returns:
- a URL for the font metadata
-
getUrlForMetadataVersion
public java.net.URL getUrlForMetadataVersion()
Description copied from interface:CloudFontConnectorReturns a URL that returns a version code for the font metadata. When this version code changes, any cached metadata should be considered stale.- Specified by:
getUrlForMetadataVersionin interfaceCloudFontConnector- Returns:
- a URL for the font metadata version
-
getLocalCacheRoot
public java.io.File getLocalCacheRoot()
Description copied from interface:CloudFontConnectorReturns the root directory of the local cache. This directory is used to store downloaded font files and metadata. Two collection instances should not share the same cache root.- Specified by:
getLocalCacheRootin interfaceCloudFontConnector- Returns:
- the local cache root
-
createFontCollection
public final CloudFontCollection createFontCollection()
Description copied from interface:CloudFontConnectorCreates a collection that will use this connector's connection details.- Specified by:
createFontCollectionin interfaceCloudFontConnector
-
-