Code example for Charset

Methods: name

0
        } 
 
        private static String toString(
            final byte[] b, final int off, final int len, final Charset charset) {
            try { 
                return new String(b, off, len, charset.name());
            } catch (final UnsupportedEncodingException e) {
                return new String(b, off, len);
            } 
        } 
 
        public String dump(final Charset charset) {
            setOutputMode(); 
            if (this.buffer.hasArray()) {
                return toString(this.buffer.array(), this.buffer.position(), this.buffer.limit(),
                    charset);
            } else { 
                final ByteBuffer dup = this.buffer.duplicate();
                final byte[] b = new byte[dup.remaining()];
                int i = 0;
                while (dup.hasRemaining()) {