private Pair < Reader , ColumnType [ ] > getReaderAndColumnTypes ( FixedWidthReadOptions options ) throws IOException { ColumnType [ ] types = options . columnTypes ( ) ; byte [ ] bytesCache = null ; if ( types == null ) { Reader reader = options . source ( ) . createReader ( bytesCache ) ; if ( options . source ( ) . file ( ) == null ) { bytesCache = CharStreams . toString ( reader ) . getBytes ( ) ; // create a new reader since we just exhausted the existing one reader = options . source ( ) . createReader ( bytesCache ) ; } types = detectColumnTypes ( reader , options ) ; } return Pair . create ( options . source ( ) . createReader ( bytesCache ) , types ) ; }
Determines column types if not provided by the user Reads all input into memory unless File was provided