Examples of newEncoder()


Examples of java.nio.charset.Charset.newEncoder()

    }
   
    final Charset charset = Charset.forName(encoding);
    if (charset.canEncode())
    {
      final CharsetEncoder charsetEncoder = charset.newEncoder();
      final char[] chars = result.toCharArray();
      final StringBuffer b = new StringBuffer(chars.length);
      for (int i = 0; i < chars.length; i++)
      {
        final char c = chars[i];
View Full Code Here

Examples of java.nio.charset.Charset.newEncoder()

                cconfig.getUnmappableInputAction() : CodingErrorAction.REPORT;
        if (charset != null) {
            chardecoder = charset.newDecoder();
            chardecoder.onMalformedInput(malformedInputAction);
            chardecoder.onUnmappableCharacter(unmappableInputAction);
            charencoder = charset.newEncoder();
            charencoder.onMalformedInput(malformedInputAction);
            charencoder.onUnmappableCharacter(unmappableInputAction);
        }
        final String id = "http-outgoing-" + Long.toString(COUNTER.getAndIncrement());
        return new LoggingManagedHttpClientConnection(
View Full Code Here

Examples of java.nio.charset.Charset.newEncoder()

     */
    private boolean hasProperDefaultCharset()
    {
        final String charSetName = System.getProperty("file.encoding");
        final Charset charSet = Charset.forName(charSetName);
        return charSet.newEncoder().canEncode('\u00e4');
    }



    /**
 
View Full Code Here

Examples of java.nio.charset.Charset.newEncoder()

     */
    private boolean hasProperDefaultCharset()
    {
        final String charSetName = System.getProperty("file.encoding");
        final Charset charSet = Charset.forName(charSetName);
        return charSet.newEncoder().canEncode('\u00e4');
    }
}
View Full Code Here

Examples of java.nio.charset.Charset.newEncoder()

  {
    this.encoding = encoding;
    this.encodingvalid = true;
   
    final Charset charset = Charset.forName(encoding);
    this.charsetEncoder = charset.newEncoder();
  }

  /**
   * Writes an opening XML tag that has no attributes.
   *
 
View Full Code Here

Examples of java.nio.charset.Charset.newEncoder()

    protected final void setEncoding(final String encoding)
    throws UnsupportedEncodingException {

        final Charset charSet = charsetForName(encoding);
        final CharsetEncoder encoder = charSet.newEncoder().onMalformedInput(
            CodingErrorAction.REPLACE).onUnmappableCharacter(
            CodingErrorAction.REPLACE);
        final float maxBytesPerChar     = encoder.maxBytesPerChar();
        final float averageBytesPerChar = encoder.averageBytesPerChar();
        final boolean fixedWidthCharset =
View Full Code Here

Examples of java.nio.charset.Charset.newEncoder()

  public void init(JMMarshallerImpl pController) throws JAXBException {
    super.init(pController);
    Charset charSet = Charset.forName(pController.getEncoding());
    if (charSet.canEncode()) {
      charsetEncoder = charSet.newEncoder();
    }
  }

  public boolean canEncode(char c) {
    return (charsetEncoder == null) ? false : charsetEncoder.canEncode(c);
View Full Code Here

Examples of java.nio.charset.Charset.newEncoder()

  @Test
  public void strings() {
    String ss = "仰望着天空寻找一位失去的故友悄无声息的离开了也带上了命运";
    Charset UTF8 = Charset.forName("UTF-8");
    CharsetEncoder enc = UTF8.newEncoder();
    // enc.

  }

  @Test
View Full Code Here

Examples of java.nio.charset.Charset.newEncoder()

        String message= NLSUtility.format(TextEditorMessages.DocumentProvider_error_illegal_encoding_message_arg, encoding);
        IStatus s= new Status(IStatus.ERROR, EditorsUI.PLUGIN_ID, IStatus.OK, message, ex);
        throw new CoreException(s);
      }

      CharsetEncoder encoder= charset.newEncoder();
      encoder.onMalformedInput(CodingErrorAction.REPLACE);
      encoder.onUnmappableCharacter(CodingErrorAction.REPORT);

      InputStream stream;
View Full Code Here

Examples of java.nio.charset.Charset.newEncoder()

            }
            return b;
        }
        try {
            Charset cc = Charset.forName(encoding);
            CharsetEncoder ce = cc.newEncoder();
            ce.onUnmappableCharacter(CodingErrorAction.IGNORE);
            CharBuffer cb = CharBuffer.wrap(text.toCharArray());
            java.nio.ByteBuffer bb = ce.encode(cb);
            bb.rewind();
            int lim = bb.limit();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.