public void testAscii() throws Exception {
  String str="AbCdEfGhIjKlMnOpQrStUvWxYzX";
  ByteArrayInputStream aa=new ByteArrayInputStream(str.getBytes("ISO8859_1"));
  InputStreamReader a=new InputStreamReader(aa,"ISO8859_1");
  try {
    int x=a.read();
    assertEquals('A',x);
    char[] c=new char[26];
    x=a.read(c,0,26);
    assertEquals("ISO-8859-1",a.getEncoding());
    assertEquals(26,x);
    assertEquals("bCdEfGhIjKlMnOpQrStUvWxYzX",String.valueOf(c));
  }
  finally {
    a.close();
  }
}

public void testAscii ( ) throws Exception { String str = "AbCdEfGhIjKlMnOpQrStUvWxYzX" ; ByteArrayInputStream aa = new ByteArrayInputStream ( str . getBytes ( "ISO8859_1" ) ) ; InputStreamReader a = new InputStreamReader ( aa , "ISO8859_1" ) ; try { int x = a . read ( ) ; assertEquals ( 'A' , x ) ; char [ ] c = new char [ 26 ] ; x = a . read ( c , 0 , 26 ) ; assertEquals ( "ISO-8859-1" , a . getEncoding ( ) ) ; assertEquals ( 26 , x ) ; assertEquals ( "bCdEfGhIjKlMnOpQrStUvWxYzX" , String . valueOf ( c ) ) ; } finally { a . close ( ) ; } }
checks if ascii encoding works with inputstreamreader
