Package java.nio.charset

Examples of java.nio.charset.UnsupportedCharsetException


        }

        try {
            return new String(data, charsetName);
        } catch (UnsupportedEncodingException e) {
            throw new UnsupportedCharsetException(charsetName);
        }
    }
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

        }
        try {
            this.b = s.getBytes(charset.name());
        } catch (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

        this.encoding = null;
    }

    public TagSoupParser(InputStream input, String documentURI, String encoding) {
        if(encoding != null && !Charset.isSupported(encoding))
            throw new UnsupportedCharsetException(String.format("Charset %s is not supported", encoding));

        this.input = input;
        this.documentURI = documentURI;
        this.encoding = encoding;
    }
View Full Code Here

                   ret = "";
                }
            }
            return ret;
        }catch(IOException ex){
            throw new UnsupportedCharsetException(enc);
        }
    }
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

            }

            try {
                return URLDecoder.decode(s, charset.name());
            } catch (UnsupportedEncodingException e) {
                throw new UnsupportedCharsetException(charset.name());
            }
        }
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

     */
    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

    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

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.