Here you can find the source of decodeToString(ByteBuffer shaderInfoLogBuffer, IntBuffer size)
Parameter | Description |
---|---|
shaderInfoLogBuffer | the ByteBuffer that contains textual information |
size | the first int in this buffer represents the size of shaderInfoLogBuffer |
public static String decodeToString(ByteBuffer shaderInfoLogBuffer, IntBuffer size)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.nio.charset.Charset; public class Main { private static final Charset CHARSET_UTF8 = Charset.forName("UTF-8"); /**/*from w w w . ja v a2s. c o m*/ * Decode the ByteBuffer into an UTF-8 String. The length of the ByteBuffer * to read is determined by the first int in the supplied IntBuffer. * * @param shaderInfoLogBuffer the ByteBuffer that contains textual information * @param size the first int in this buffer represents the size of shaderInfoLogBuffer * @return the UTF-8 contents of shaderInfoLogBuffer */ public static String decodeToString(ByteBuffer shaderInfoLogBuffer, IntBuffer size) { int s = size.get(0); byte[] bs = new byte[s]; shaderInfoLogBuffer.get(bs, 0, bs.length); return new String(bs, CHARSET_UTF8); } }