Package java.io

Examples of java.io.UnsupportedEncodingException


        if (normalizedEncoding == null) {
            String m = new org.apache.cxf.common.i18n.Message("INVALID_ENCODING_MSG", LOG, new Object[] {
                enc
            }).toString();
            LOG.log(Level.WARNING, m);
            throw new UnsupportedEncodingException(m);
        }

        return normalizedEncoding;
    }
View Full Code Here


    throws NotEnoughDataInByteBufferException, UnsupportedEncodingException {
    int len = length();
    if (len < size) {
      throw new NotEnoughDataInByteBufferException(len, size);
    }
    UnsupportedEncodingException encodingException = null;
    String result = null;
    if (len > 0) {
      try {
        if (encoding != null) {
          result = new String(buffer, 0, size, encoding);
View Full Code Here

                    reader = new UCSReader(istream, UCSReader.UCS4LE);
                }
            } else {
                // Fatal error, UCSReader will fail to decode this properly
                String s = "Unsupported byte order for ISO-10646-UCS-4 encoding.";
                throw new UnsupportedEncodingException(s);
            }
        } else if ("ISO-10646-UCS-2".equals(charset)) {
            if (null != isBigEndian) {
                boolean isBE = isBigEndian.booleanValue();

                if (isBE) {
                    reader = new UCSReader(istream, UCSReader.UCS4BE);
                } else {
                    reader = new UCSReader(istream, UCSReader.UCS4LE);
                }
            } else {
                // Cannot construct UCSReader without byte order info
                String s = "Byte order must be specified for ISO-10646-UCS-2.";
                throw new UnsupportedEncodingException(s);
            }
        } else {
            reader = new InputStreamReader(istream, charset);
        }
View Full Code Here

        Charset charset = lastCharset;
        if (charset == null || !encoding.equalsIgnoreCase(charset.name())) {
            try {
                charset = Charset.forName(encoding);
            } catch (IllegalCharsetNameException e) {
                throw (UnsupportedEncodingException) (new UnsupportedEncodingException(
                        encoding).initCause(e));
            } catch (UnsupportedCharsetException e) {
                throw (UnsupportedEncodingException) (new UnsupportedEncodingException(
                        encoding).initCause(e));
            }
            lastCharset = charset;
        }
        return charset;
View Full Code Here

        {
            return new OutputStreamWriter(output, encoding);
        }
        catch (java.lang.IllegalArgumentException iae) // java 1.1.8
        {
            throw new UnsupportedEncodingException(encoding);
        }
    }
View Full Code Here

      throw new NullPointerException();
    }

    // If the given encoding is an empty string throw an exception.
        if (enc.length() == 0) {
            throw new UnsupportedEncodingException(Msg
                    .getString("K00a5", "enc")); //$NON-NLS-1$
        }

    StringBuffer result = new StringBuffer(s.length());
    ByteArrayOutputStream out = new ByteArrayOutputStream();
View Full Code Here

        {
            return new OutputStreamWriter(output, encoding);
        }
        catch (java.lang.IllegalArgumentException iae) // java 1.1.8
        {
            throw new UnsupportedEncodingException(encoding);
        }
    }
View Full Code Here

     */
    public static String codepageToEncoding(final int codepage)
    throws UnsupportedEncodingException
    {
        if (codepage <= 0)
            throw new UnsupportedEncodingException
                ("Codepage number may not be " + codepage);
        switch (codepage)
        {
            case Constants.CP_UTF16:
                return "UTF-16";
View Full Code Here

        Message message = mailMessage.getMessage();
        try {
            return message.getContent();
        } catch (Exception e) {
            // try to fix message in case it has an unsupported encoding in the Content-Type header
            UnsupportedEncodingException uee = ObjectHelper.getException(UnsupportedEncodingException.class, e);
            if (uee != null) {
                LOG.debug("Unsupported encoding detected: " + uee.getMessage());
                try {
                    String contentType = message.getContentType();
                    String type = ObjectHelper.before(contentType, "charset=");
                    if (type != null) {
                        // try again with fixed content type
View Full Code Here

        // a bad encoding string is passed on to java.io.InputStreamReader
        // Check ahead to make sure we don't pass a bad encoding
        if (isInvalidEncodingString(encoding)) {
            String errorMsg = StringUtil.strcat("UnsupportedEncodingException thrown: encoding parameter : ", encoding, " is invalid.");
            Log.util.debug(errorMsg);
            throw new UnsupportedEncodingException(errorMsg);
        }
        return new BufferedReader(new InputStreamReader(i, encoding)); // OK
    }
View Full Code Here

TOP

Related Classes of java.io.UnsupportedEncodingException

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.