Example usage for io.vertx.core.buffer Buffer getString

List of usage examples for io.vertx.core.buffer Buffer getString

Introduction

In this page you can find the example usage for io.vertx.core.buffer Buffer getString.

Prototype

String getString(int start, int end, String enc);

Source Link

Document

Returns a copy of a sub-sequence the Buffer as a String starting at position start and ending at position end - 1 interpreted as a String in the specified encoding

Usage

From source file:io.advantageous.qbit.vertx.BufferUtils.java

License:Apache License

public static String readString(final Buffer buffer, final int[] location) {

    final short size = buffer.getShort(location[0]);

    int start = location[0] + 2;
    int end = start + size;

    final String utf_8 = buffer.getString(start, end, StandardCharsets.UTF_8.displayName());

    location[0] = end;//w ww.j a  v  a2  s.  com

    return utf_8;
}