Skip to content

A very, very, very light-weight utility for Java applications allowing you to store all kind of serializable object in one or more files under a certain key.

License

Notifications You must be signed in to change notification settings

DeBukkIt/SimpleFileStorage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimpleFileStorage

A very, very, very lightweight tool to persist any serialisable objects in a file in Java and, for example, load them again after restarting the application.

In principle, this is a HashMap<String, Object> that persists itself. The organisation of the stored data is therefore done via key-value pairs.

To avoid heavy load on the hard disk, autosave can be disabled in the constructor. Persistence then only takes place when save() is called manually.

Usage Example

// Init
FileStorage fs = new FileStorage("path/to/my_storage_file.dat", new Class[] { Class1.class, Class2.class });

Class1 testObject1 = ...;
Class2 testObject2 = ...;

// Put and store data
fs.put("key1", testObject1);
fs.put("key2", testObject2);

// Restart application

// Get data
Class1 loadedObject = fs.get("key1");

About

A very, very, very light-weight utility for Java applications allowing you to store all kind of serializable object in one or more files under a certain key.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages