Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/clemos/hx-kcs

A Kansas-City standard decoder written in Haxe
https://github.com/clemos/hx-kcs

Last synced: 6 days ago
JSON representation

A Kansas-City standard decoder written in Haxe

Awesome Lists containing this project

README

        

#### A [Kansas-City standard](http://en.wikipedia.org/wiki/Kansas_City_standard) decoder written in [Haxe](http://www.haxe.org)

**Ported from [py-kcs](http://www.dabeaz.com/py-kcs/index.html)**

### Features

* **Target agnostic** (tested mostly with Flash, but should work on any target)
* **UTF-8 support**
* No unit tests ;)

### Usage

```haxe

import kcs.Decoder;
import flash.media.Microphone;
import flash.events.SampleDataEvent;

class Test {
static function main(){
var mic = Microphone.get();
var kcs = new Decoder();

mic.addEventListener( SampleEventData.SAMPLE_EVENT , readMic );
}

static function readMic( e : SampleEventData ){
var output : BytesData = kcs.decode( e.data );
var str : String = output.toString();
trace(str);
}
}

```

### Notes

The decoder keeps data that couldn't be decoded
after every `decode()` call (incomplete bytes, unterminated UTF-8 characters, etc).
You can flush these remaining data using the decoder's `init()` method.

### See also

* https://github.com/clemos/log-for-data-decoder
* https://github.com/davidonet/LogForData2013