public void save(DataOutputStream out) throws IOException {
   literalLengthModel.save(out);
   offsetNibble0Model.save(out);
   offsetNibble1Model.save(out);
   offsetNibble2Model.save(out);
   offsetNibble3Model.save(out);
 }
 public Codeword encode(int symbol) {
   switch (state) {
     case LiteralLengthState:
       if (symbol > 255) {
         state = State.OffsetNibble0State;
       }
       return literalLengthModel.encode(symbol);
     case OffsetNibble0State:
       state = State.OffsetNibble1State;
       return offsetNibble0Model.encode(symbol);
     case OffsetNibble1State:
       state = State.OffsetNibble2State;
       return offsetNibble1Model.encode(symbol);
     case OffsetNibble2State:
       state = State.OffsetNibble3State;
       return offsetNibble2Model.encode(symbol);
     case OffsetNibble3State:
       state = State.LiteralLengthState;
       return offsetNibble3Model.encode(symbol);
     default:
       throw new RuntimeException();
   }
 }
 public Codeword decode(int bits) {
   switch (state) {
     case LiteralLengthState:
       Codeword codeword = literalLengthModel.decode(bits);
       if (codeword.getSymbol() > 255) {
         state = State.OffsetNibble0State;
       }
       return codeword;
     case OffsetNibble0State:
       state = State.OffsetNibble1State;
       return offsetNibble0Model.decode(bits);
     case OffsetNibble1State:
       state = State.OffsetNibble2State;
       return offsetNibble1Model.decode(bits);
     case OffsetNibble2State:
       state = State.OffsetNibble3State;
       return offsetNibble2Model.decode(bits);
     case OffsetNibble3State:
       state = State.LiteralLengthState;
       return offsetNibble3Model.decode(bits);
     default:
       throw new RuntimeException();
   }
 }
 public Codeword getCodewordForEOF() {
   return literalLengthModel.getCodewordForEOF();
 }