private void encodeLiteral ( OutputStream out , byte [ ] name , byte [ ] value , IndexType indexType , int nameIndex ) throws IOException { int mask ; int prefixBits ; switch ( indexType ) { case INCREMENTAL : mask = 0x40 ; prefixBits = 6 ; break ; case NONE : mask = 0x00 ; prefixBits = 4 ; break ; case NEVER : mask = 0x10 ; prefixBits = 4 ; break ; default : throw new IllegalStateException ( "should not reach here" ) ; } encodeInteger ( out , mask , prefixBits , nameIndex == - 1 ? 0 : nameIndex ) ; if ( nameIndex == - 1 ) { encodeStringLiteral ( out , name ) ; } encodeStringLiteral ( out , value ) ; }
Encode literal header field according to Section 6 . 2 .