public String toString() { final StringBuffer buffer = new StringBuffer(); buffer.append("SVNCharsetConvertor"); buffer.append("[from=").append(myDecoder.charset().displayName()); buffer.append(", to=").append(myEncoder.charset().displayName()); buffer.append(']'); return buffer.toString(); }
@JRubyMethod public IRubyObject inspect(ThreadContext context) { return RubyString.newString( context.runtime, "#<Encoding::Converter: " + srcDecoder.charset().name() + " to " + destEncoder.charset().name()); }
/** @tests java.io.InputStreamReader(java.io.InputStream, java.nio.charset.CharsetDecoder) */ public void test_ConstructorLjava_io_InputStreamLjava_nio_charset_CharsetDecoder() throws IOException { CharsetDecoder decoder = Charset.forName("utf-8").newDecoder(); try { reader = new InputStreamReader(null, decoder); fail(); } catch (NullPointerException e) { // Expected } try { reader = new InputStreamReader(in, (CharsetDecoder) null); fail(); } catch (NullPointerException e) { // Expected } InputStreamReader reader2 = new InputStreamReader(in, decoder); assertEquals(Charset.forName(reader2.getEncoding()), decoder.charset()); reader2.close(); }