Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/clemos/hx-kcs
- Owner: clemos
- Created: 2013-06-20T14:44:18.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-12-08T16:04:33.000Z (almost 11 years ago)
- Last Synced: 2024-04-14T18:20:38.622Z (7 months ago)
- Language: Haxe
- Size: 129 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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