private PushbackInputStream init_Reader ( InputStream readerIn ) { // Reader newReader = readerIn; // // Initializing the reader as a BufferedReader // // cut test processing time by approximately 50% // // default uses 8192 character buffer // if(!(newReader instanceof BufferedReader)) { // newReader = new BufferedReader(newReader); // Since JDK1.1 // } // // Initializing the reader as a PushbackReader is // // a requirement of the parser to be able to put back // // read ahead characters. // if(!(newReader instanceof PushbackReader)) { // newReader = new PushbackReader(newReader); // Since JDK1.1 // } if ( ! ( readerIn instanceof BufferedInputStream ) ) { readerIn = new BufferedInputStream ( readerIn ) ; } if ( ! ( readerIn instanceof PushbackInputStream ) ) { readerIn = new PushbackInputStream ( readerIn ) ; } // return the proper reader object to the parser setup return ( PushbackInputStream ) readerIn ; }
Casts the input reader to a PushbackReader or creates a new PushbackReader from the Reader passed in . The reader is also transformed into a BufferedReader if necessary .