Socket
Book a DemoInstallSign in
Socket

org.blobbase:blobbase

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

org.blobbase:blobbase

The ConvertAPI helps converting various file formats. Creating PDF and Images from various sources like Word, Excel, Powerpoint, images, web pages or raw HTML codes. Merge, Encrypt, Split, Repair and Decrypt PDF files. And many others files manipulations. In just few minutes you can integrate it into your application and use it easily. The ConvertAPI client library makes it easier to use the Convert API from your Java 8 projects without having to build your own API calls.

Source
mavenMaven
Version
1.0.0
Version published
Maintainers
1
Source

BlobBase

A Simple, Embeddable, Thread-Safe, Open Source, BLOB storage API.

BlobBase is a NoSQL database that stores/retrieves data from a managed directory structure on disk. Keys are mapped to file names located in the database that can then be opened, written to, and read from. It is intended to be used as a replacement for developers using a relational database to store image data. By using BlobBase instead of a traditional database, they can vastly decrease the sizes of their databases and improve performance and reliability.

The chief advantages of this architecture are:

  • Simplicity – each stored object is simply a file in the file system.
  • Speed – Key lookups and retrieval are very very fast even for extremely large databases.
  • Robustness – since the database uses the file system it is extremely easy to manage and protected using RAID.

Code Examples

Write a Blob to database

 // location  of database
 File root = new File("myDb");
 // instantiate BlobBase
 BlobBase blobBase = BlobBase.getInstance(root);
 // create a file in database with the assigned key '123'
 File file = map.createFile(123);
 FileOutputStream out = new FileOutputStream(file);
/* do something with output stream */

Read a Blob from database

 // location  of database
 File root = new File("myDb");
 // instantiate BlobBase
 BlobBase blobBase = BlobBase.getInstance(root);
 // get file from database using the key '123'
 File file = blobBase.getFile(123);
 FileInputStream in = new FileInputStream(file);
/* do something with input stream */

Delete Blob from database

 // location  of database
 File root = new File("myDb");
 // instantiate BlobBase
 BlobBase blobBase = BlobBase.getInstance(root);
 // delete blob with key '123'
 boolean bdeleted = blobBase.deleteFile(123);        
 assertTrue(bdeleted);

BlobBase IO Routines

BlobBaseInputStream and BlobBaseOutputStream are two convenience methods for reading and writing to the database.

BlobBaseOutputStream

 // location  of database
 File root = new File("myDb");
 // instantiate BlobBase
 BlobBase blobBase = BlobBase.getInstance(root);
 // get BlobBaseOutputStream for key '123'
 BlobBaseOutputStream os = new BlobBaseOutputStream(blobBase,123);
 os.write("hello world".getBytes());

BlobBaseInputStream

 // location  of database
 File root = new File("myDb");
 // instantiate BlobBase
 BlobBase blobBase = BlobBase.getInstance(root);
 // get BlobBaseInputStream for key '123'
 BlobBaseInputStream is = new BlobBaseInputStream(blobBase,123);
 while (true)
 {
   int b = is.read();
   if (b == -1)
   {
     break;
   }
   // do something with byte read 
 }

Compression BlobBase can automaticaaly compress your data When using BlobBaseInputStream and BlobBaseOutputStream. To enable this compression do the following:

// set location  of database
File root = new File("./myDb");

// instantiate BlobBase
BlobBase blobBase = BlobBase.getInstance(root);
// turn compression on
blobBase.setCompressed();

Builing Sources

This SDK uses maven as its build system. Running mvn install will build the system.

$ mvn install

Their are tests that can be run as well (may require editing of database path). To run these

$ mvn test -DskipTests=false

FAQs

Package last updated on 10 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts