Java IO Tutorial - Java CharsetDecoder.replacement()








Syntax

CharsetDecoder.replacement() has the following syntax.

public final String replacement()

Example

In the following code shows how to use CharsetDecoder.replacement() method.

import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
//from   www. j  a  v  a 2s  .c o m
public class Main {
  public static void main(String[] argv) throws Exception {
    Charset charset = Charset.forName("ISO-8859-1");
    CharsetDecoder decoder = charset.newDecoder();

    System.out.println(decoder.replacement());
  }
}

The code above generates the following result.