Examples of onMalformedInput()


Examples of java.nio.charset.CharsetDecoder.onMalformedInput()

  {

    static CharsetDecoder strictDecoder(Charset cs)
    {
      CharsetDecoder dec = cs.newDecoder();
      dec.onMalformedInput(CodingErrorAction.REPORT);
      dec.onUnmappableCharacter(CodingErrorAction.REPORT);
      return dec;
    }

    static int[] toCodePoints(String str)
View Full Code Here

Examples of java.nio.charset.CharsetDecoder.onMalformedInput()

    private String tryDecodeAsString(byte[] data) {
        try {
            // We do this so we get strict input processing
            CharsetDecoder decoder = Charsets.UTF_8.newDecoder();
            decoder.onMalformedInput(CodingErrorAction.REPORT);
            decoder.onUnmappableCharacter(CodingErrorAction.REPORT);

            ByteBuffer byteBuffer = ByteBuffer.wrap(data);
            CharBuffer charBuffer = decoder.decode(byteBuffer);
            return charBuffer.toString();
View Full Code Here

Examples of java.nio.charset.CharsetDecoder.onMalformedInput()

            if (!(isTrusted = (cs.getClass().getClassLoader0() == null))) {
                ba =  Arrays.copyOfRange(ba, off, off + len);
                off = 0;
            }
        }
        cd.onMalformedInput(CodingErrorAction.REPLACE)
          .onUnmappableCharacter(CodingErrorAction.REPLACE)
          .reset();
        if (cd instanceof ArrayDecoder) {
            int clen = ((ArrayDecoder)cd).decode(ba, off, len, ca);
            return safeTrim(ca, clen, cs, isTrusted);
View Full Code Here

Examples of java.nio.charset.CharsetDecoder.onMalformedInput()

    public CharsetDecoder newDecoder() {
        CodingErrorAction errorAction = this.configuration
                .getCodingErrorAction();

        CharsetDecoder decoder = this.encoding.newDecoder();
        decoder.onMalformedInput(errorAction);
        decoder.onUnmappableCharacter(errorAction);
        return decoder;
    }

    /**
 
View Full Code Here

Examples of java.nio.charset.CharsetEncoder.onMalformedInput()

        IStatus s= new Status(IStatus.ERROR, Plugin.PLUGIN_ID, IStatus.OK, message, ex);
        throw new CoreException(s);
      }

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

      InputStream stream;

      try {
View Full Code Here

Examples of java.nio.charset.CharsetEncoder.onMalformedInput()

     * @see
     * com.alimama.mdrill.utils.zip.ZipEncoding#canEncode(java.lang.String)
     */
    public boolean canEncode(String name) {
        CharsetEncoder enc = this.charset.newEncoder();
        enc.onMalformedInput(CodingErrorAction.REPORT);
        enc.onUnmappableCharacter(CodingErrorAction.REPORT);

        return enc.canEncode(name);
    }

View Full Code Here

Examples of java.nio.charset.CharsetEncoder.onMalformedInput()

     * com.alimama.mdrill.utils.zip.ZipEncoding#encode(java.lang.String)
     */
    public ByteBuffer encode(String name) {
        CharsetEncoder enc = this.charset.newEncoder();

        enc.onMalformedInput(CodingErrorAction.REPORT);
        enc.onUnmappableCharacter(CodingErrorAction.REPORT);

        CharBuffer cb = CharBuffer.wrap(name);
        ByteBuffer out = ByteBuffer.allocate(name.length()
                                             + (name.length() + 1) / 2);
View Full Code Here

Examples of java.nio.charset.CharsetEncoder.onMalformedInput()

        if (charset != null) {
            chardecoder = charset.newDecoder();
            chardecoder.onMalformedInput(malformedInputAction);
            chardecoder.onUnmappableCharacter(unmappableInputAction);
            charencoder = charset.newEncoder();
            charencoder.onMalformedInput(malformedInputAction);
            charencoder.onUnmappableCharacter(unmappableInputAction);
        }
        final DefaultBHttpClientConnection conn = new DefaultBHttpClientConnection(
                this.cconfig.getBufferSize(),
                this.cconfig.getFragmentSizeHint(),
View Full Code Here

Examples of java.nio.charset.CharsetEncoder.onMalformedInput()

        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(
                id,
View Full Code Here

Examples of java.nio.charset.CharsetEncoder.onMalformedInput()

        Map<Charset, CharsetEncoder> map = encoders.get();
        CharsetEncoder e = map.get(charset);
        if (e != null) {
            e.reset();
            e.onMalformedInput(CodingErrorAction.REPLACE);
            e.onUnmappableCharacter(CodingErrorAction.REPLACE);
            return e;
        }

        e = charset.newEncoder();
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.