538 if (sp < sl && isMalformed4_3(sa[sp])) {
539 da[dp++] = replacement().charAt(0);
540 continue;
541 }
542 da[dp++] = replacement().charAt(0);
543 return dp;
544 } else {
545 if (malformedInputAction() != CodingErrorAction.REPLACE)
546 return -1;
547 da[dp++] = replacement().charAt(0);
548 }
549 }
550 return dp;
551 }
552 }
553
554 private static final class Encoder extends CharsetEncoder
555 implements ArrayEncoder {
556
557 private Encoder(Charset cs) {
558 super(cs, 1.1f, 3.0f);
559 }
560
561 public boolean canEncode(char c) {
562 return !Character.isSurrogate(c);
563 }
564
565 public boolean isLegalReplacement(byte[] repl) {
566 return ((repl.length == 1 && repl[0] >= 0) ||
567 super.isLegalReplacement(repl));
568 }
569
570 private static CoderResult overflow(CharBuffer src, int sp,
571 ByteBuffer dst, int dp) {
572 updatePositions(src, sp, dst, dp);
573 return CoderResult.OVERFLOW;
574 }
575
576 private static CoderResult overflow(CharBuffer src, int mark) {
577 src.position(mark);
578 return CoderResult.OVERFLOW;
|
538 if (sp < sl && isMalformed4_3(sa[sp])) {
539 da[dp++] = replacement().charAt(0);
540 continue;
541 }
542 da[dp++] = replacement().charAt(0);
543 return dp;
544 } else {
545 if (malformedInputAction() != CodingErrorAction.REPLACE)
546 return -1;
547 da[dp++] = replacement().charAt(0);
548 }
549 }
550 return dp;
551 }
552 }
553
554 private static final class Encoder extends CharsetEncoder
555 implements ArrayEncoder {
556
557 private Encoder(Charset cs) {
558 super(cs, 1.1f, 4.0f);
559 }
560
561 public boolean canEncode(char c) {
562 return !Character.isSurrogate(c);
563 }
564
565 public boolean isLegalReplacement(byte[] repl) {
566 return ((repl.length == 1 && repl[0] >= 0) ||
567 super.isLegalReplacement(repl));
568 }
569
570 private static CoderResult overflow(CharBuffer src, int sp,
571 ByteBuffer dst, int dp) {
572 updatePositions(src, sp, dst, dp);
573 return CoderResult.OVERFLOW;
574 }
575
576 private static CoderResult overflow(CharBuffer src, int mark) {
577 src.position(mark);
578 return CoderResult.OVERFLOW;
|