question: public boolean isLegalReplacement ( byte [ ] replacement ) { if ( decoder == null ) { decoder = charset . 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 ( ) ; }
target:  Tests whether the given argument is legal as this encoder's replacement byte array. The given byte array is legal if and only if it can be decoded into characters.