An open API service indexing awesome lists of open source software.

https://github.com/uswitch/baldr-old-dead

Pure and light binary records
https://github.com/uswitch/baldr-old-dead

Last synced: 11 months ago
JSON representation

Pure and light binary records

Awesome Lists containing this project

README

          

![Baldr](http://upload.wikimedia.org/wikipedia/commons/e/ea/Each_arrow_overshot_his_head_by_Elmer_Boyd_Smith.jpg)

# baldr

Named after the "god of light and purity" in Norse mythology. A light
and pure file format for records of bytes.

## Usage

Add the library to your project dependencies.

[baldr "0.1.1"]

Write byte-arrays to an `OutputStream` using `baldr-writer`.

```clojure
(let [ostream (ByteArrayOutputStream. 100)
write (baldr.core/baldr-writer ostream)]
(write (byte-array [1 2 3]))
(write (byte-array [1 2 3 4]))
(.close ostream))
```

Read seq of byte-arrays from an `InputStream` using `baldr-seq`.

```clojure
(let [ostream (ByteArrayOutputStream. 100)
write (baldr.core/baldr-writer ostream)]
(write (byte-array [1 2 3]))
(write (byte-array [1 2 3 4]))
(.close ostream)
(baldr.core/baldr-seq (ByteArrayInputStream. (.toByteArray ostream))))
```

## License

Copyright © uSwitch

Distributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.