Java CharsetDecoder .flush (CharBuffer out)

Syntax

CharsetDecoder.flush(CharBuffer out) has the following syntax.

public final CoderResult flush(CharBuffer out)

Example

In the following code shows how to use CharsetDecoder.flush(CharBuffer out) method.


//w  w w  .  j a  v  a2s . c  o  m
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;

public class Main {
  public static void main(String[] argv) throws Exception {
    Charset charset = Charset.forName("ISO-8859-1");
    CharsetDecoder decoder = charset.newDecoder();

    CharBuffer cbuf = CharBuffer.allocate(10);
    
    decoder.flush(cbuf);
  }
}




















Home »
  Java Tutorial »
    java.nio.charset »




Charset
CharsetDecoder
CharsetEncoder
StandardCharsets