Code example for Charset

Methods: newEncoder

0
 
	public Writer getTextWriter(OutputStream out) throws IOException
	{ 
		 
		 
		return new OutputStreamWriter(out, body.newEncoder());
	} 
 
	public Reader getPermissiveTextReader(InputStream in) throws IOException
	{ 
		 
		 
		CharsetDecoder permissive = body.newDecoder();
		permissive.onMalformedInput(CodingErrorAction.REPLACE);
		permissive.onUnmappableCharacter(CodingErrorAction.REPLACE);
		return new InputStreamReader(in, permissive);
	} 
	 
 
	 
	private final Charset body;