Here you can find the source of decodeUTF8(final ByteBuffer buf)
Parameter | Description |
---|---|
buf | the UTF-8 encoded buffer to convert |
public static String decodeUTF8(final ByteBuffer buf)
//package com.java2s; /*// w w w. j a v a2s. c o m * * JMeta - Meta's java implementation * * Copyright (C) 2013-2015 Pablo Joubert * Copyright (C) 2013-2015 Thomas Lavocat * Copyright (C) 2013-2015 Nicolas Michon * * This file is part of JMeta. * * JMeta is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * JMeta is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ import java.nio.ByteBuffer; import java.nio.charset.Charset; public class Main { /** * Decode the content of the given ByteBuffer, from its position to its limit, to a String. * * @param buf the UTF-8 encoded buffer to convert * @return the newly decoded string */ public static String decodeUTF8(final ByteBuffer buf) { return Charset.forName("UTF-8").decode(buf).toString(); } }