All Projects → sromku → Android Storage

sromku / Android Storage

Licence: apache-2.0
Create, read, delete, append, encrypt files and more, on internal or external disk spaces with a really simple API

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Android Storage

Kissme
Kissme: Kotlin Secure Storage Multiplatform
Stars: ✭ 351 (-58.95%)
Mutual labels:  storage, library
Cosmonaut
🌐 A supercharged Azure CosmosDB .NET SDK with ORM support
Stars: ✭ 309 (-63.86%)
Mutual labels:  storage, library
Immortaldb
🔩 A relentless key-value store for the browser.
Stars: ✭ 2,962 (+246.43%)
Mutual labels:  storage, library
Jsstore
A complete IndexedDB wrapper with SQL like syntax.
Stars: ✭ 430 (-49.71%)
Mutual labels:  storage, library
Usbmuxd
A socket daemon to multiplex connections from and to iOS devices
Stars: ✭ 847 (-0.94%)
Mutual labels:  library
M2x Python
AT&T M2X Python Library
Stars: ✭ 25 (-97.08%)
Mutual labels:  library
Apos.input
Polling input library for MonoGame.
Stars: ✭ 25 (-97.08%)
Mutual labels:  library
Ofxgrafica
A simple and configurable plotting library for openFrameworks
Stars: ✭ 24 (-97.19%)
Mutual labels:  library
Mypythonlib
🐍 Python 库(工欲善其事,必先利其器) 标准库(https://docs.python.org/zh-cn/2.7/library/index.html)
Stars: ✭ 9 (-98.95%)
Mutual labels:  library
Noty
⛔️ DEPRECATED - Dependency-free notification library that makes it easy to create alert - success - error - warning - information - confirmation messages as an alternative the standard alert dialog.
Stars: ✭ 6,725 (+686.55%)
Mutual labels:  library
Cute php
PHP version of the beanstalkd-backed job queuing system.
Stars: ✭ 7 (-99.18%)
Mutual labels:  library
Similarloadingview
A stylish loading view for Android
Stars: ✭ 26 (-96.96%)
Mutual labels:  library
Abclinuxuapi
API for http://abclinuxu.cz.
Stars: ✭ 8 (-99.06%)
Mutual labels:  library
Badx12
A Python Library for parsing ANSI ASC X12 files.
Stars: ✭ 25 (-97.08%)
Mutual labels:  library
Bloc
A predictable state management library that helps implement the BLoC design pattern
Stars: ✭ 8,214 (+860.7%)
Mutual labels:  library
Gpsdetector Library
🌎 Android library. If GPS disabled, dialog shown and if user confirms GPS enabled. (2016)
Stars: ✭ 24 (-97.19%)
Mutual labels:  library
Migrator
Opinionated database migration library for Go applications.
Stars: ✭ 7 (-99.18%)
Mutual labels:  library
Openebs
Leading Open Source Container Attached Storage, built using Cloud Native Architecture, simplifies running Stateful Applications on Kubernetes.
Stars: ✭ 7,277 (+751.11%)
Mutual labels:  storage
Stringplus
Funny and minimal string library for C++ inspired by underscore.string
Stars: ✭ 7 (-99.18%)
Mutual labels:  library
Awesome Android
😎 A curated list of awesome Android resources
Stars: ✭ 26 (-96.96%)
Mutual labels:  library

android-storage

Library to create, read, delete, append, encrypt files and more, on internal or external disk spaces with a really simple API.

Latest Release

Download

dependencies {
    compile 'com.snatik:storage:2.1.0'
}

Don't forget to update AndroidManifest.xml and add next line:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Usage

// init
Storage storage = new Storage(getApplicationContext());

// get external storage
String path = storage.getExternalStorageDirectory();

// new dir
String newDir = path + File.separator + "My Sample Directory";
storage.createDirectory(newDir);

Check all options, scroll down ;)

Sample app

The app has some simple UI screens and uses the storage library. This is just an example of what can be done with this lib.

Options

Initialize

Storage storage = new Storage(getApplicationContext());

Work on External Storage.

  • Check if external writable

     boolean isWritable = storage.isExternalWritable();
    
  • Root external storage path

     String path = storage.getExternalStorageDirectory();
    
  • If you want to use a particular public directory

    Storage storage = SimpleStorage.getExternalStorage(Environment.DIRECTORY_PICTURES);
    

Work on Internal Storage.

  • Directory for storing app internal files (documentation):

     String path = SimpleStorage.getInternalFilesDirectory();
    
  • Cache dir

     String path = SimpleStorage.getInternalCacheDirectory();
    
  • Root internal storage dir

     String path = SimpleStorage.getInternalRootDirectory();
    

Create directory

  • Create directory

     storage.createDirectory(path);
    
  • Create directory and override the existing one.

     storage.createDirectory(path, true);
    

Create file

Create a new file with the content in it.

storage.createFile(path, "some content of the file");

The content of the file can be one of the next types:

  • String
  • byte[]
  • Bitmap
  • Storable

Read file

Read the content of any file to byte array.

byte[] bytes = storage.readFile(path);

Read the content of the file to String.

String content = storage.readTextFile(path);

Append content to file

storage.appendFile(path, "more new data");

You can append:

  • String
  • byte[]

Copy

storage.copy(fromPath, toPath);

Move

storage.move(fromPath, toPath);

Delete directory

storage.deleteDirectory(path);

Delete file

storage.deleteFile(path);

Get files

  • Get files in ordered way by: name, date, size

     List<File> files = storage.getFiles(path, OrderType.DATE);
    
  • Get files and filter by regular expression:

     String regex = ...;
     List<File> files = storage.getFiles(path, regex);
    
  • Get all nested files (without the directories)
     List<File> files = storage.getNestedFiles(path);
    

More...

  • Is directory exists

     boolean dirExists = storage.isDirectoryExists(path);
    
  • Is file exists

     boolean fileExists = storage.isFileExist(path);
    

Security configuration

You can write and read files while the content is encrypted. It means, that no one can read the data of your files from external or internal storage.

You will continue using the same api as before. The only thing you need to do is to configure the Simple Storage library before the you want to create/read encrypted data.

// set encryption
String IVX = "abcdefghijklmnop"; // 16 lenght - not secret
String SECRET_KEY = "secret1234567890"; // 16 lenght - secret
byte[] SALT = "0000111100001111".getBytes(); // random 16 bytes array

// build configuratio
EncryptConfiguration configuration = new EncryptConfiguration.Builder()
	.setEncryptContent(IVX, SECRET_KEY, SALT)
	.build();
	
// configure the simple storage
storage.setEncryptConfiguration(configuration);

Now, you can create a new file with content and the content will be automatically encrypted.
You can read the file and the content will be decrypted.

Example

Create file with next content "this is the secret data":

storage.setEncryptConfiguration(configuration);
storage.createFile(path, "this is the secret data");

If we open the file to see it's content then it we will something like this: „f°α�ΤG†_iΐp . It looks good :)

And now, read the file data with the same api:

storage.setEncryptConfiguration(configuration);
String content = storage.readTextFile(path);

You will see that the content will be: "this is the secret data".

Tests

Just play and check the sample app ;)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].