public RandomElementReader getElementReader ( final String elementType ) throws IOException { if ( elementType == null ) { throw new NullPointerException ( "elementType must not be null." ) ; } if ( ! buffer . containsKey ( elementType ) ) { throw new IllegalArgumentException ( "No such element type." ) ; } if ( closed ) { throw new IllegalStateException ( "Reader is closed." ) ; } while ( buffer . get ( elementType ) == null ) { ElementReader eReader = reader . nextElementReader ( ) ; BufferedElementReader bReader = new BufferedElementReader ( eReader ) ; bReader . detach ( ) ; buffer . put ( eReader . getElementType ( ) . getName ( ) , bReader ) ; } return buffer . get ( elementType ) . duplicate ( ) ; }
Returns an element reader for the given element type .