Example usage for org.apache.commons.lang3 StringUtils toString

List of usage examples for org.apache.commons.lang3 StringUtils toString

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils toString.

Prototype

@Deprecated
public static String toString(final byte[] bytes, final String charsetName)
        throws UnsupportedEncodingException 

Source Link

Document

Converts a byte[] to a String using the specified character encoding.

Usage

From source file:com.kolich.curacao.mappers.request.types.body.RequestBodyAsCharsetAwareStringMapper.java

@Override
public final T resolveWithBody(final RequestBody annotation, final CuracaoContext context, final byte[] body)
        throws Exception {
    // Convert the byte[] array from the request body into a String
    // using the derived character encoding.
    final String encoding = getRequestEncoding(context);
    return resolveWithStringAndEncoding(annotation,
            // The encoding String itself.
            StringUtils.toString(body, encoding),
            // The encoding of the String.
            encoding);//from   ww  w  . j  av a 2  s.co  m
}