private int readIntoArray(byte[] to, int offset, Dictionary dict) throws IOException {
      byte status = StreamUtils.readByte(in);
      if (status == Dictionary.NOT_IN_DICTIONARY) {
        // status byte indicating that data to be read is not in dictionary.
        // if this isn't in the dictionary, we need to add to the dictionary.
        int length = StreamUtils.readRawVarint32(in);
        IOUtils.readFully(in, to, offset, length);
        dict.addEntry(to, offset, length);
        return length;
      } else {
        // the status byte also acts as the higher order byte of the dictionary entry.
        short dictIdx = StreamUtils.toShort(status, StreamUtils.readByte(in));
        byte[] entry = dict.getEntry(dictIdx);
        if (entry == null) {
          throw new IOException("Missing dictionary entry for index " + dictIdx);
        }
        // now we write the uncompressed value.
        Bytes.putBytes(to, offset, entry, 0, entry.length);
        return entry.length;
      }
    }
Create and setup a {@link WALCellCodec} from the CompressionContext. Cell Codec classname is
read from {@link Configuration}. Fully prepares the codec for use.
@param conf        {@link Configuration} to read for the user-specified codec. If none is
                   specified, uses a {@link WALCellCodec}.
@param compression compression the codec should use
@return a {@link WALCellCodec} ready for use.
@throws UnsupportedOperationException if the codec cannot be instantiated
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALCellCodec.java