void splitKeyVal ( byte [ ] line , int length , Text key , Text val ) throws IOException { int numKeyFields = getNumOfKeyFields ( ) ; byte [ ] separator = getFieldSeparator ( ) ; // Need to find numKeyFields separators int pos = UTF8ByteArrayUtils . findBytes ( line , 0 , length , separator ) ; for ( int k = 1 ; k < numKeyFields && pos != - 1 ; k ++ ) { pos = UTF8ByteArrayUtils . findBytes ( line , pos + separator . length , length , separator ) ; } try { if ( pos == - 1 ) { key . set ( line , 0 , length ) ; val . set ( "" ) ; } else { StreamKeyValUtil . splitKeyVal ( line , 0 , length , key , val , pos , separator . length ) ; } } catch ( CharacterCodingException e ) { LOG . warn ( StringUtils . stringifyException ( e ) ) ; } }
Split a line into key and value .