public String readUTF8EncodedString(int stringLength) {
        if (stringLength > 0 && this.bufferPosition + stringLength <= this.bufferData.length) {
            this.bufferPosition += stringLength;
            try {
                return new String(this.bufferData, this.bufferPosition - stringLength, stringLength, CHARSET_UTF8);
            } catch (UnsupportedEncodingException e) {
                throw new IllegalStateException(e);
            }
        }
        LOGGER.warning("invalid string length: " + stringLength);
        return null;
    }
public String readUTF8EncodedString ( int stringLength ) { if ( stringLength > 0 && this . bufferPosition + stringLength <= this . bufferData . length ) { this . bufferPosition += stringLength ; try { return new String ( this . bufferData , this . bufferPosition - stringLength , stringLength , CHARSET_UTF8 ) ; } catch ( UnsupportedEncodingException e ) { throw new IllegalStateException ( e ) ; } } LOGGER . warning ( "invalid string length: " + stringLength ) ; return null ; }
Decodes the given amount of bytes from the read buffer to a string.

@param stringLength the length of the string in bytes.
@return the UTF-8 decoded string (may be null).