Class TextFileSystemViewCrudMapAdapter<Entry>
- Type Parameters:
Entry- The type of the file system entry.
- All Implemented Interfaces:
CrudMapAdapter<String,String>, Serializable
CrudMapAdapter for a map from file keys to the file's text content, backed by a ICommonFileSystem.
The map key is the ID of the file. The ID can be any arbitrary string that is recognized by the configured entry encoder and decoder.
The map value is the text content as
obtained by the ICommonFileSystem. Uses the configured charset for encoding and decoding the binary data
to/from strings.
Wraps a ICommonFileSystem and forwards all file reads and writes to that view.
Note: The iterator implementations may not be efficient. The intended use case of this class is to serve as a
simple get-set map for known files, i.e. you should only use Map.get(Object), Map.put(Object, Object), Map.containsKey(Object), Map.remove(Object).
- Since:
- 8.3.0
- Author:
- XIMA MEDIA GmbH
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder for aTextFileSystemViewCrudMapAdapter.Nested classes/interfaces inherited from interface CrudMapAdapter
CrudMapAdapter.Immutable<Key,Value>, CrudMapAdapter.SetLike<Value> -
Method Summary
Modifier and TypeMethodDescriptionstatic <Entry> TextFileSystemViewCrudMapAdapter.Builder<Entry> builder(ISerializableFunction<Entry, String> entryEncoder, ISerializableFunction<String, Entry> entryDecoder) Creates a new builder for aTextFileSystemViewCrudMapAdapter, using the given encoder and decoder to convert between a file ID and a file system entry.voidRemoves the mapping for the given key.Enumerates all keys for which a mapping may be present.Gets the value for the given key.voidAssociates a value with the given key.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CrudMapAdapter
computeSize, isEmpty
-
Method Details
-
delete
Description copied from interface:CrudMapAdapterRemoves the mapping for the given key.- Specified by:
deletein interfaceCrudMapAdapter<String,String> - Parameters:
fileId- Key to disassociate with any values.
-
enumerateCandidateKeys
Description copied from interface:CrudMapAdapterEnumerates all keys for which a mapping may be present. May include additional keys for which no value is available, seeCrudMapAdapter.computeSize(). Must NOT contain duplicate keys.- Specified by:
enumerateCandidateKeysin interfaceCrudMapAdapter<String,String> - Returns:
- A set with all potential keys.
-
get
Description copied from interface:CrudMapAdapterGets the value for the given key. Returnsnullwhen no value is available for the key.- Specified by:
getin interfaceCrudMapAdapter<String,String> - Parameters:
fileId- Key to access.- Returns:
- The value associated with the key, or
nullwhen no value is associated with the key.
-
set
Description copied from interface:CrudMapAdapterAssociates a value with the given key.- Specified by:
setin interfaceCrudMapAdapter<String,String> - Parameters:
fileId- Key to associate with a different value.content- Value to associate with the key, nevernull.
-
builder
public static <Entry> TextFileSystemViewCrudMapAdapter.Builder<Entry> builder(ISerializableFunction<Entry, String> entryEncoder, ISerializableFunction<String, Entry> entryDecoder) Creates a new builder for aTextFileSystemViewCrudMapAdapter, using the given encoder and decoder to convert between a file ID and a file system entry.Uses a
ICommonFileSystemto read and write file text content. The map key is the file ID (as returned by the configured entry encoder), the map value is the file's text content. Uses the configured charset to encode and decode the binary data to / from strings.- Type Parameters:
Entry- The type of the file system entry.- Parameters:
entryEncoder- Encoder that converts a file system entry to a file ID string.entryDecoder- Decoder that converts a file ID string to a file system entry.- Returns:
- A new builder for a
TextFileSystemViewCrudMapAdapter.
-