public boolean isLegalReplacement(byte[] replacement) {if (decoder == null) {decoder = cs.newDecoder();decoder.onMalformedInput(CodingErrorAction.REPORT);decoder.onUnmappableCharacter(CodingErrorAction.REPORT);}ByteBuffer in = ByteBuffer.wrap(replacement);CharBuffer out = CharBuffer.allocate((int) (replacement.length * decoder.maxCharsPerByte()));CoderResult result = decoder.decode(in, out, true);return !result.isError();}

public virtual bool isLegalReplacement(byte[] replacement_1){if (decoder == null){decoder = cs.newDecoder();decoder.onMalformedInput(java.nio.charset.CodingErrorAction.REPORT);decoder.onUnmappableCharacter(java.nio.charset.CodingErrorAction.REPORT);}java.nio.ByteBuffer @in = java.nio.ByteBuffer.wrap(replacement_1);java.nio.CharBuffer @out = java.nio.CharBuffer.allocate((int)(replacement_1.Length* decoder.maxCharsPerByte()));java.nio.charset.CoderResult result = decoder.decode(@in, @out, true);return !result.isError();}
