public class FileSystemTiledReader extends TiledReader
A FileSystemTiledReader is a type of TiledReader that locates and identifies resources using standard paths through the local file system, and caches resources in a HashMap with canonical path strings as keys. This is the best type of TiledReader to use if you're not doing anything fancy with file storage and not trying to integrate TiledReader with an existing asset management system.
LOGGER, TILED_VERSION, TMX_VERSION, VERSION| Constructor and Description |
|---|
FileSystemTiledReader()
Constructs a new FileSystemTiledReader.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
clearCachedResources()
Clears the cache, causing it to no longer identify any resource by any
path.
|
TiledResource |
getCachedResource(String path)
Returns the resource in the cache identified by the specified path, which
must be a canonical path by the standards of getCanonicalPath().
|
String |
getCanonicalPath(String path)
Returns a version of the specified path string that is both absolute and
unique.
|
InputStream |
getInputStream(String path)
Returns an InputStream that reads the file data at the location of the
specified path, which must be a canonical path by the standards of
getCanonicalPath().
|
String |
joinPaths(String basePath,
String relativePath)
Returns a path string that points to the same location as the specified
relative path does when followed from the location of the specified base
path.
|
protected void |
removeCachedResource(String path)
Sets the cache to no longer identify any resource by the specified path,
which must be a canonical path by the standards of getCanonicalPath().
|
protected void |
setCachedResource(String path,
TiledResource resource)
Sets the cache to identify the specified resource by the specified path,
which must be a canonical path by the standards of getCanonicalPath().
|
clearResources, getMap, getObjectTypes, getTemplate, getTileset, readObjectTypes, removeResource, setObjectTypespublic FileSystemTiledReader()
public final String getCanonicalPath(String path)
TiledReaderjava.io.File.getCanonicalPath().getCanonicalPath in class TiledReaderpath - The path to find the canonical version ofpublic final String joinPaths(String basePath, String relativePath)
TiledReaderjava.nio.file.Path.resolve().joinPaths in class TiledReaderbasePath - The base pathrelativePath - The relative pathpublic final InputStream getInputStream(String path)
TiledReadergetInputStream in class TiledReaderpath - The canonical path to the file datapublic final TiledResource getCachedResource(String path)
TiledReadergetCachedResource in class TiledReaderpath - The canonical path to the file from which the resource was
readprotected final void setCachedResource(String path, TiledResource resource)
TiledReadersetCachedResource in class TiledReaderpath - The canonical path by which to identify the resourceresource - The resource to be identified by the pathprotected final void removeCachedResource(String path)
TiledReaderremoveCachedResource in class TiledReaderpath - The canonical path that identifies the resource to remove
from the cacheprotected final void clearCachedResources()
TiledReaderclearCachedResources in class TiledReaderCopyright © 2020. All rights reserved.