Package java.nio.charset

Examples of java.nio.charset.UnsupportedCharsetException


        }
        try {
            this.content = string.getBytes(charset.name());
        } catch (final UnsupportedEncodingException ex) {
            // should never happen
            throw new UnsupportedCharsetException(charset.name());
        }
        if (contentType != null) {
            setContentType(contentType.toString());
        }
    }
View Full Code Here


        }
        try {
            this.b = s.getBytes(charset.name());
        } catch (final UnsupportedEncodingException ex) {
            // should never happen
            throw new UnsupportedCharsetException(charset.name());
        }
        this.buf = ByteBuffer.wrap(this.b);
        this.content = b;
        this.buffer = this.buf;
        if (contentType != null) {
View Full Code Here

    public String toString(int index, int length, String charsetName) {
        try {
            return new String(array, index, length, charsetName);
        } catch (UnsupportedEncodingException e) {
            throw new UnsupportedCharsetException(charsetName);
        }
    }
View Full Code Here

        }

        try {
            return new String(data, charsetName);
        } catch (UnsupportedEncodingException e) {
            throw new UnsupportedCharsetException(charsetName);
        }
    }
View Full Code Here

     */
    public static ChannelBuffer copiedBuffer(ByteOrder endianness, String string, String charsetName) {
        try {
            return wrappedBuffer(endianness, string.getBytes(charsetName));
        } catch (UnsupportedEncodingException e) {
            throw new UnsupportedCharsetException(charsetName);
        }
    }
View Full Code Here

        }

        try {
            return URLDecoder.decode(s, charset);
        } catch (UnsupportedEncodingException e) {
            throw new UnsupportedCharsetException(charset);
        }
    }
View Full Code Here

            try {
                return new String(
                        buffer.array(), index + buffer.arrayOffset(), length,
                        charsetName);
            } catch (UnsupportedEncodingException e) {
                throw new UnsupportedCharsetException(charsetName);
            }
        } else {
            byte[] tmp = new byte[length];
            ((ByteBuffer) buffer.duplicate().position(index)).get(tmp);
            try {
                return new String(tmp, charsetName);
            } catch (UnsupportedEncodingException e) {
                throw new UnsupportedCharsetException(charsetName);
            }
        }
    }
View Full Code Here

    private static String encodeComponent(String s, String charset) {
        try {
            return URLEncoder.encode(s, charset).replaceAll("\\+", "%20");
        } catch (UnsupportedEncodingException e) {
            throw new UnsupportedCharsetException(charset);
        }
    }
View Full Code Here

            if (Charset.isSupported(charset)) {
                Charset.forName(charset);
                return;
            }
        }
        throw new UnsupportedCharsetException(charset);
    }
View Full Code Here

    private static String encodeComponent(String s, String charset) {
        try {
            return URLEncoder.encode(s, charset).replaceAll("\\+", "%20");
        } catch (UnsupportedEncodingException e) {
            throw new UnsupportedCharsetException(charset);
        }
    }
View Full Code Here

TOP

Related Classes of java.nio.charset.UnsupportedCharsetException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.