GithubHelp home page GithubHelp logo

panzerfrank / blobs-java Goto Github PK

View Code? Open in Web Editor NEW

This project forked from datastax-examples/blobs-java

0.0 1.0 0.0 39 KB

Write and read blobs with Cassandra using the Java DataStax Driver

Home Page: https://www.datastax.com/examples

License: Apache License 2.0

Java 100.00%

blobs-java's Introduction

Querying Blobs in Java

Binary Large Objects ( Blobs ) can be useful when the data doesn't fit into a standard Cassandra data type. Some examples of common Blob usage are for images or large files. Be careful of the size of your blobs, though: it's best to break them up so that each blob cell is 1 MB or less.

Contributor(s): Olivier Michallat, Tomasz Lelek - derived from here

Objectives

  • Demonstrate how to write and read these blob data type columns in a Java application

Project Layout

How this Sample Works

By default, the Java DataStax Driver maps blob types to java.nio.ByteBuffer. The ByteBuffer API is a bit tricky to use at times, so we will show common pitfalls as well. We strongly recommend that you read the java.nio.Buffer and ByteBuffer API docs and become familiar with the capacity, limit, and position properties. This tutorial is also useful.

Setup and Running

Prerequisites

  • JDK 14
  • A Cassandra cluster is running and accessible through the contacts points and data center identified in application.conf

Running

Building

At the project root level

mvn clean package

This builds the JAR file located at target/storing-and-retrieving-blobs-1.0.jar

Run the program

java -jar target/storing-and-retrieving-blobs-1.0.jar

This will produce output similar to the following:

Writing retrieved buffer to /var/folders/v5/f93lqcsx2fj4__41f7l5w5j80000gn/T/blob6758286736353817789.png

blobs-java's People

Contributors

jakerobb avatar bechbd avatar

Watchers

James Cloos 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.