Here you can find the source of newWriter(WritableByteChannel ch, Charset cs)
public static Writer newWriter(WritableByteChannel ch, Charset cs)
//package com.java2s; import java.io.Writer; import java.nio.channels.Channels; import java.nio.channels.WritableByteChannel; import java.nio.charset.Charset; public class Main { public static Writer newWriter(WritableByteChannel ch, Charset cs) { if (ch == null) return null; return Channels.newWriter(ch, cs.newEncoder(), -1); }/*www .j av a2 s. co m*/ }