Here you can find the source of UTF8GetString(final byte[] bytes, final int index, final int count)
Parameter | Description |
---|---|
bytes | The byte array containing the sequence of bytes to decode. |
index | The index of the first byte to decode. |
count | The number of bytes to decode. |
public static String UTF8GetString(final byte[] bytes, final int index, final int count)
//package com.java2s; // Licensed under the MIT license. See License.txt in the project root. import java.nio.charset.Charset; public class Main { private static final Charset UTF8 = Charset.forName("UTF-8"); /**/* ww w .j a v a 2 s . co m*/ * Decodes all the bytes in the specified byte array into a string. * * @param bytes The byte array containing the sequence of bytes to decode. * @return A string that contains the results of decoding the specified sequence of bytes. */ public static String UTF8GetString(final byte[] bytes) { final String result = new String(bytes, UTF8); return result; } /** * Decodes a range of bytes from a byte array into a string. * * @param bytes The byte array containing the sequence of bytes to decode. * @param index The index of the first byte to decode. * @param count The number of bytes to decode. * @return A string that contains the results of decoding the specified sequence of bytes. */ public static String UTF8GetString(final byte[] bytes, final int index, final int count) { final String result = new String(bytes, index, count, UTF8); return result; } }