Top Description Fields Constructors Methods
org.javamoney.moneta.spi.loader.urlconnection

pack-priv Class URLConnectionResourceCache

extends Object
implements ResourceCache
Class Inheritance
All Implemented Interfaces
org.javamoney.moneta.spi.loader.ResourceCache
Imports
org.javamoney.moneta.spi.loader.ResourceCache, java.io.File, .IOException, java.nio.file.Files, java.util.Map, .Objects, java.util.concurrent.ConcurrentHashMap, java.util.logging.Level, .Logger, javax.money.MonetaryException

Default implementation of ResourceCache, using the local file system.
Author
Anatole Tresch

Field Summary

Modifier and TypeField and Description
private final Map<String, File>
cachedResources

Cached resources.

private File
localDir

Local temp directory.

private static final Logger
LOG

The logger used.

private static final String
SUFFIX

Suffix for files created.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
clear(String resourceId)

Implements org.javamoney.moneta.spi.loader.ResourceCache.clear.

Remove a cache entry.

public boolean
isCached(String resourceId)

Implements org.javamoney.moneta.spi.loader.ResourceCache.isCached.

Allows to query if a resource with the given id is present within the local cache.

public byte[]
read(String resourceId)

Implements org.javamoney.moneta.spi.loader.ResourceCache.read.

Reads the given resource, identified by the resourceId, from the cache.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public void
write(String resourceId, byte[] data)

Implements org.javamoney.moneta.spi.loader.ResourceCache.write.

Write the given byte array to the format store and register it on the given resource ID.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

cachedResourcesback to summary
private final Map<String, File> cachedResources

Cached resources.

localDirback to summary
private File localDir

Local temp directory.

LOGback to summary
private static final Logger LOG

The logger used.

SUFFIXback to summary
private static final String SUFFIX

Suffix for files created.

Constructor Detail

URLConnectionResourceCacheback to summary
public URLConnectionResourceCache()

Constructor.

Method Detail

clearback to summary
public void clear(String resourceId)

Implements org.javamoney.moneta.spi.loader.ResourceCache.clear.

Doc from org.javamoney.moneta.spi.loader.ResourceCache.clear.

Remove a cache entry.

Annotations
@Override
isCachedback to summary
public boolean isCached(String resourceId)

Implements org.javamoney.moneta.spi.loader.ResourceCache.isCached.

Doc from org.javamoney.moneta.spi.loader.ResourceCache.isCached.

Allows to query if a resource with the given id is present within the local cache.

Annotations
@Override
readback to summary
public byte[] read(String resourceId)

Implements org.javamoney.moneta.spi.loader.ResourceCache.read.

Doc from org.javamoney.moneta.spi.loader.ResourceCache.read.

Reads the given resource, identified by the resourceId, from the cache.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
writeback to summary
public void write(String resourceId, byte[] data)

Implements org.javamoney.moneta.spi.loader.ResourceCache.write.

Doc from org.javamoney.moneta.spi.loader.ResourceCache.write.

Write the given byte array to the format store and register it on the given resource ID.

Annotations
@Override