private static byte[] uncompressByteString(ByteString bs, Dictionary dict) throws IOException {
    InputStream in = bs.newInput();
    byte status = StreamUtils.readByte(in);
    if (status == Dictionary.NOT_IN_DICTIONARY) {
      byte[] arr = new byte[StreamUtils.readRawVarint32(in)];
      int bytesRead = in.read(arr);
      if (bytesRead != arr.length) {
        throw new IOException("Cannot read; wanted " + arr.length + ", but got " + bytesRead);
      }
      if (dict != null) {
        dict.addEntry(arr, 0, arr.length);
      }
      return arr;
    } else {
      // Status here is the higher-order byte of index 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);
      }
      return entry;
    }
  }
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