Package java.nio.charset

Examples of java.nio.charset.UnsupportedCharsetException


     */
  public void setCharset(String charset) {
    if(charset==null || charset.trim().length()==0)
      return;
    if(Charset.isSupported(charset)==false) {
      throw new UnsupportedCharsetException(charset);
    }
    this.charset = charset;
  }
View Full Code Here


  private Charset lookupCharset(final String csn)
  throws UnsupportedCharsetException {
    if (Charset.isSupported(csn)) {
      return Charset.forName(csn);
    }
    throw new UnsupportedCharsetException(csn);
  }
View Full Code Here

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

            if (Charset.isSupported(charset)) {
                Charset.forName(charset);
                return;
            }
        }
        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

        }

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

        }

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

        }
        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

            byte[] ba = readBody();
            String enc = request.getCharacterEncoding();
            try {
                this.strBody = enc!=null new String(ba, enc) : new String(ba);
            } catch (UnsupportedEncodingException e) {
                throw new UnsupportedCharsetException(enc);
            }
        }
        return strBody;
    }
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.