GithubHelp home page GithubHelp logo

johanrisch / lynx Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 116 KB

Lynx is a simple, yet powerful and extendable library for storing datatypes on disk using key-value pairs.

License: MIT License

Java 100.00%

lynx's Introduction

Lynx

Release

Lynx is a simple, yet powerful and extendable library for storing datatypes on disk using key-value pairs. It consists of one core java library and two optional android libararies of which only one should be included.

The core part can be included by adding jitpack to your list of maven repositories; to do this add the folloing into your root bruild.gradle file:

maven { url "https://jitpack.io" }

and then adding the dependency to lynx in your modules build.gradle file:

compile 'com.github.johanrisch.Lynx:lynx:1.1'

Lynx is designed to be as extendable as possible and this is done by dependency inversion on all of it's components. This has one major caveat; namely that the core java libaray does not have all of the implementations needed to actually get started right away. However, there are two android libraries which contains default implementations of the needed components. The difference between the two libraries is that one uses gson and the other one uses jackson for object (de)serialization. So all you have to do is choose one of the lines:

compile 'com.github.johanrisch.Lynx:lynx-android-gson:1.1'

or

compile 'com.github.johanrisch.Lynx:lynx-android-jackson:1.1'

##How to use If you want a full working example on how to use the libaray check out the sample app. At the moment it is very naïvely implemented, a fuller example will be uploaded in the near future.

###Creating an instance To create an instance of as LynxDiskStorage stroing your CustomClass with a string ke, simply use the builder:

LynxDiskStorage<String, CustomClass> lynxStorage =Lynx.create(new LynxExternalStorageInfo(context), String.class, CustomClass.class)
                                     .withMapper(new LynxObjectMapper())
                                     .withCipherHandler(new LynxCipherHandler(new LynxDefaultPasswordSupplier(context), new LynxBouncyCastleProvider(), new LynxBase64Impl()))
                                     .named("testSecureStorage")
                                     .build();

Now you can simply use the lynxStorage to store and retrieve your instances:

lynxStorage.set("aUniqueKey",aCustomClassInstance);
CustomClass loadedInstance = lynxStorage.get("aUniqueKey");
List<CustomClass> allStoredInstances = lynxStorage.getAll();

If you do not want to use encryption you can simple use UnSafeLynxCipherHandler which will just pass the bytes through to the FileHandler.

That is pretty much all you need to know to get started using lynx. In the next version I will add more thorogh documentation on how to customize the behaviour of your LynxDiskStorage. But for now you'll have to confide to the javadoc of the interfaces, implementations, or unit tests in order to customize each component.

Happy storing

/Risch

lynx's People

Contributors

johanrisch avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.