Here you can find the source of asUTFString(byte[] content)
public static String asUTFString(byte[] content)
//package com.java2s; /*/*w w w. ja v a2s .co m*/ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ import java.nio.charset.StandardCharsets; public class Main { public static final String EMPTY = ""; public static String asUTFString(byte[] content) { return asUTFString(content, 0, content.length); } public static String asUTFString(byte[] content, int offset, int length) { return (content == null || length == 0 ? EMPTY : new String(content, offset, length, StandardCharsets.UTF_8)); } }