PetrGlad / utf8-decoder

Reactive UTF-8 parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reactive non blocking parser for UTF-8 encoding

Download

Dependency for build.gradle:

repositories {
  jcenter()
}

dependencies {
      compile 'net.readmarks:utf8-decoder:2.0.0'
}

Usage example

import net.readmarks.utf8.Utf8Decoder2;
class Utf8Printer {
  static void printDecodedUtf8(byte[] utf8bytes) {
    final Utf8decoder2 parser = new Utf8decoder2(System.out.print, 2048);
    parser.put(utf8bytes); // You can call this multiple times.
    parser.end(); // Check encoding and flush at end of input stream.
  }
}

This parser allows incoming data be parsed incrementally without blocking current thread while waiting for incoming data. This allows to avoid blocking current thread while waiting for new data. With this parser you do not call a function to obtain input but instead call this parser whenever new piece of input data is available.

References

About

Reactive UTF-8 parser

License:Other


Languages

Language:Java 100.0%