question: public void parseHeader ( InputStream is ) throws java . io . IOException { nkeys = 0 ; if ( is == null ) return ; char s [ ] = new char [ 10 ] ; int firstc = is . read ( ) ; while ( firstc != '\n' && firstc != '\r' && firstc >= 0 ) { int len = 0 ; int keyend = - 1 ; int c ; boolean inKey = firstc > ' ' ; s [ len ++ ] = ( char ) firstc ; parseloop : { parseloop2 : while ( ( c = is . read ( ) ) >= 0 ) { switch ( c ) { case ':' : if ( inKey && len > 0 ) keyend = len ; inKey = false ; break ; case '\t' : c = ' ' ; case ' ' : inKey = false ; break ; case '\r' : case '\n' : firstc = is . read ( ) ; if ( c == '\r' && firstc == '\n' ) { firstc = is . read ( ) ; if ( firstc == '\r' ) firstc = is . read ( ) ; } if ( firstc == '\n' || firstc == '\r' || firstc > ' ' ) break parseloop ; continue parseloop2 ; } if ( len >= s . length ) { char ns [ ] = new char [ s . length * 2 ] ; System . arraycopy ( s , 0 , ns , 0 , len ) ; s = ns ; } s [ len ++ ] = ( char ) c ; } firstc = - 1 ; } while ( len > 0 && s [ len - 1 ] <= ' ' ) len -- ; String k ; if ( keyend <= 0 ) { k = null ; keyend = 0 ; } else { k = String . copyValueOf ( s , 0 , keyend ) ; if ( keyend < len && s [ keyend ] == ':' ) keyend ++ ; while ( keyend < len && s [ keyend ] <= ' ' ) keyend ++ ; } String v ; if ( keyend >= len ) v = new String ( ) ; else v = String . copyValueOf ( s , keyend , len - keyend ) ; add ( k , v ) ; } }
target:  Parse a MIME header from an input stream. 