Package java.nio.charset

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


   * @param encoding Encoding to retrieve the CharsetDecoder for
   * @return CharSetDecoder for the given encoding
   */
  private CharsetDecoder getJavaEncoding(String encoding) {
    Charset charset = Charset.forName(encoding);
    return charset.newDecoder();
  }

  /**
   * Determines the appropriate {@link FlagParsingStrategy} based on the FLAG definition line taken from the affix file
   *
 
View Full Code Here


        }
        this.substitute = substitute;
        this.outputCharset = outputCharset;
        this.stream = os;
        Charset cs = Charset.forName(outputCharset);
        cd = cs.newDecoder().onMalformedInput(CodingErrorAction.REPORT).onUnmappableCharacter(CodingErrorAction.REPLACE);
    }

    /*
     * Decode the bytes in the byte buffer and append to the char buffer.
     *
 
View Full Code Here

        final CodingErrorAction malformedInputAction = cconfig.getMalformedInputAction() != null ?
                cconfig.getMalformedInputAction() : CodingErrorAction.REPORT;
        final CodingErrorAction unmappableInputAction = cconfig.getUnmappableInputAction() != null ?
                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);
View Full Code Here

      @Override
      public Object answer()
          throws Throwable
      {
        Charset charset = Charset.forName("UTF-8");
        CharsetDecoder decoder = charset.newDecoder();
        responseStr.append(decoder.decode((ByteBuffer)EasyMock.getCurrentArguments()[0]));
        return responseStr.length();
      }
    });
    EasyMock.replay(chunkedWritableByteChannel);
View Full Code Here

      @Override
      public Object answer()
          throws Throwable
      {
        Charset charset = Charset.forName("UTF-8");
        CharsetDecoder decoder = charset.newDecoder();
        responseStr.append(decoder.decode((ByteBuffer)EasyMock.getCurrentArguments()[0]));
        return responseStr.length();
      }
    });
    EasyMock.replay(chunkedWritableByteChannel);
View Full Code Here

      @Override
      public Object answer()
          throws Throwable
      {
        Charset charset = Charset.forName("UTF-8");
        CharsetDecoder decoder = charset.newDecoder();
        responseStr.append(decoder.decode((ByteBuffer)EasyMock.getCurrentArguments()[0]));
        return responseStr.length();
      }
    });
    EasyMock.replay(chunkedWritableByteChannel);
View Full Code Here

      @Override
      public Object answer()
          throws Throwable
      {
        Charset charset = Charset.forName("UTF-8");
        CharsetDecoder decoder = charset.newDecoder();
        responseStr.append(decoder.decode((ByteBuffer)EasyMock.getCurrentArguments()[0]));
        return responseStr.length();
      }
    });
    EasyMock.replay(chunkedWritableByteChannel);
View Full Code Here

        private void writeTo(Writer out, String encoding) throws IOException{
            //Get the charset based on the encoding or return the default if
            //encoding == null
            Charset charset = (encoding == null) ?
                    Charset.defaultCharset() : Charset.forName(encoding);
            CharsetDecoder decoder = charset.newDecoder();
            CharBuffer decodedBuffer = decoder.decode(
                    ByteBuffer.wrap(_byteArrayOutputStream.getInnerArray(),
                            0,_byteArrayOutputStream.getInnerCount()));
            if (decodedBuffer.hasArray()){
                out.write(decodedBuffer.array());
View Full Code Here

   
    public void refreshComments() {
        Charset latin1 = Charset.forName("ISO-8859-1");
        CharsetDecoder decoder = null;
        if (latin1 != null)
            decoder = latin1.newDecoder();
        if (_ss != null) {
            _scomments = _map.getServiceComments(_ss.getHostName(), _ss.getServiceDescription());
            if (_scomments != null) {
               DefaultTableModel model = (DefaultTableModel)jTableComments.getModel();
               int rows = jTableComments.getRowCount();
View Full Code Here

   
    public void refreshComments() {
        Charset latin1 = Charset.forName("ISO-8859-1");
        CharsetDecoder decoder = null;
        if (latin1 != null)
            decoder = latin1.newDecoder();
        ImageIcon hostIcon = _map.getIcon_Vertex(_h.getName()).getOriginal();
        if (hostIcon != null) {
            jLblHostImage.setIcon(hostIcon);
        }
 
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.