Package java.io

Examples of java.io.UnsupportedEncodingException


    StringBuilder sb = new StringBuilder(numChars > 500 ? numChars / 2 : numChars);
    int i = 0;

    if (enc.length() == 0)
    {
      throw new RuntimeException(new UnsupportedEncodingException(
        "URLDecoder: empty string enc parameter"));
    }

    char c;
    byte[] bytes = null;
View Full Code Here


      {
        // check the supplied encoding ...
        // only Cp- encodings are supported ...
        if (EncodingRegistry.getInstance().isSupportedEncoding(cp) == false)
        {
          throw new UnsupportedEncodingException("The encoding " + cp + "is not valid");
        }

        final String encodingName = cp.substring(2);
        try
        {
          int i;
          if (Character.isDigit(encodingName.charAt(encodingName.length() - 1)) == false)
          {
            i = Integer.parseInt(encodingName.substring(0, encodingName.length() - 1));
            i += 10000;
          }
          else
          {
            i = Integer.parseInt(encodingName);
          }
          final byte[] retval = new byte[2];
          retval[0] = (byte) (i >> 8);
          retval[1] = (byte) (i & 0xff);
          return retval;
        }
        catch (Exception e)
        {
          throw new UnsupportedEncodingException("The encoding " + cp + "is not valid");
        }
      }
      throw new UnsupportedEncodingException("The encoding " + cp + " is no codepage encoding");
    }
View Full Code Here

    public Charset getCharset(String name)
    throws UnsupportedEncodingException {
        if (name == null) return(this.getDefaultCharset());
        Charset charset = (Charset)this.charsets.get(name.toLowerCase());
        if (charset != null) return(charset);
        throw new UnsupportedEncodingException("Unsupported charset \""
                                               + name + "\"");
    }
View Full Code Here

    public void set_encoding_failure() throws Exception
    {
        HttpServletRequest sr = mockHttpServletRequest();

        String encoding = "the-encoding";
        UnsupportedEncodingException exception = new UnsupportedEncodingException("Oops.");

        sr.setCharacterEncoding(encoding);
        getMocksControl().andThrow(exception);

        replay();
View Full Code Here

    public void set_encoding_failure() throws Exception
    {
        HttpServletRequest sr = mockHttpServletRequest();

        String encoding = "the-encoding";
        UnsupportedEncodingException exception = new UnsupportedEncodingException("Oops.");

        sr.setCharacterEncoding(encoding);
        setThrowable(exception);

        expect(sr.getCharacterEncoding()).andReturn(null);
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

   {
      ArrayList<LinkInfo> info = new ArrayList<LinkInfo>();
      if( name.endsWith(".properties") )
         parseLinkProperties(is, info, props);
      else
         throw new UnsupportedEncodingException("Unknown link format: "+name);
      return info;
   }
View Full Code Here

            final FormDataParser parser = originalServlet.getFormParserFactory().createParser(exchange);
            if (parser != null) {
                parser.setCharacterEncoding(env);
            }
        } catch (UnsupportedCharsetException e) {
            throw new UnsupportedEncodingException();
        }
    }
View Full Code Here

                    String c = Headers.extractQuotedValueFromHeader(contentType, "charset");
                    if (c != null) {
                        try {
                            charSet = Charset.forName(c);
                        } catch (UnsupportedCharsetException e) {
                            throw new UnsupportedEncodingException();
                        }
                    }
                }
            }
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

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.