/*
Chararrayreader is an implementation of using a character array as the source input stream. This class has two constructors, each of which requires an array of characters to provide the data source:
Chararrayreader (char array [])
Chararrayreader (char array [], int start, int numchars)
Here, array is the input source. The second constructor creates a reader from the subset of your character array, which starts with the index specified by start and has a length of numchars.
*/
// Demonstrate chararrayreader.
Import java. Io .*;
Class chararrayreaderdemo {
Public static void main (string [] ARGs) throws ioexception {
String strtmp = "abcdefghijklmnopqrstuvwxyz ";
Int intlen = strtmp. Length ();
Char C [] = new char [intlen];
Strtmp. getchars (0, intlen, C, 0 );
Chararrayreader input1 = new chararrayreader (C );
Chararrayreader input2 = new chararrayreader (C, 0, 5 );
Int I;
System. Out. println ("input1 is :");
While (I = input1.read ())! =-1 ){
System. Out. Print (char) I );
}
System. Out. println ();
System. Out. println ("input2 is :");
While (I = input2.read ())! =-1 ){
System. Out. Print (char) I );
}
System. Out. println ();
}
}