public B2CConverter(Charset charset, boolean replaceOnError) { byte[] left = new byte[LEFTOVER_SIZE]; leftovers = ByteBuffer.wrap(left); CodingErrorAction action; if (replaceOnError) { action = CodingErrorAction.REPLACE; } else { action = CodingErrorAction.REPORT; } // Special case. Use the Apache Harmony based UTF-8 decoder because it // - a) rejects invalid sequences that the JVM decoder does not // - b) fails faster for some invalid sequences if (charset.equals(StandardCharsets.UTF_8)) { decoder = new Utf8Decoder(); } else { decoder = charset.newDecoder(); } decoder.onMalformedInput(action); decoder.onUnmappableCharacter(action); }
@Override protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) { if (in.hasArray() && out.hasArray()) { return decodeHasArray(in, out); } return decodeNotHasArray(in, out); }
Utf8Decoder decoder = new Utf8Decoder(); payload.position(2); CoderResult cr = decoder.decode(payload, cb, true); payload.position(0); if (cr.isError()) {
Utf8Decoder decoder = new Utf8Decoder(); payload.position(2); CoderResult cr = decoder.decode(payload, cb, true); payload.position(0); if (cr.isError()) {
@Override protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) { if (in.hasArray() && out.hasArray()) { return decodeHasArray(in, out); } return decodeNotHasArray(in, out); }
public B2CConverter(String encoding, boolean replaceOnError) throws IOException { byte[] left = new byte[LEFTOVER_SIZE]; leftovers = ByteBuffer.wrap(left); CodingErrorAction action; if (replaceOnError) { action = CodingErrorAction.REPLACE; } else { action = CodingErrorAction.REPORT; } Charset charset = getCharset(encoding); // Special case. Use the Apache Harmony based UTF-8 decoder because it // - a) rejects invalid sequences that the JVM decoder does not // - b) fails faster for some invalid sequences if (charset.equals(StandardCharsets.UTF_8)) { decoder = new Utf8Decoder(); } else { decoder = charset.newDecoder(); } decoder.onMalformedInput(action); decoder.onUnmappableCharacter(action); }
@Override protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) { if (in.hasArray() && out.hasArray()) { return decodeHasArray(in, out); } return decodeNotHasArray(in, out); }
public B2CConverter(String encoding, boolean replaceOnError) throws IOException { byte[] left = new byte[LEFTOVER_SIZE]; leftovers = ByteBuffer.wrap(left); CodingErrorAction action; if (replaceOnError) { action = CodingErrorAction.REPLACE; } else { action = CodingErrorAction.REPORT; } Charset charset = getCharset(encoding); // Special case. Use the Apache Harmony based UTF-8 decoder because it // - a) rejects invalid sequences that the JVM decoder does not // - b) fails faster for some invalid sequences if (charset.equals(UTF_8)) { decoder = new Utf8Decoder(); } else { decoder = charset.newDecoder(); } decoder.onMalformedInput(action); decoder.onUnmappableCharacter(action); }
@Override protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) { if (in.hasArray() && out.hasArray()) { return decodeHasArray(in, out); } return decodeNotHasArray(in, out); }
} else if (opCode == Constants.OPCODE_TEXT) { InputStreamReader r = new InputStreamReader(wsIs, new Utf8Decoder()); doOnTextData(r); } else if (opCode == Constants.OPCODE_CLOSE){
} else if (opCode == Constants.OPCODE_TEXT) { InputStreamReader r = new InputStreamReader(wsIs, new Utf8Decoder()); onTextData(r); } else if (opCode == Constants.OPCODE_CLOSE){