1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with this 4 * work for additional information regarding copyright ownership. The ASF 5 * licenses this file to you under the Apache License, Version 2.0 (the 6 * "License"); you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 * License for the specific language governing permissions and limitations 15 * under the License. 16 */ 17 package org.apache.hadoop.hbase.io.encoding; 18 19 import java.io.IOException; 20 21 import org.apache.hadoop.hbase.classification.InterfaceAudience; 22 import org.apache.hadoop.hbase.io.hfile.HFileContext; 23 import org.apache.hadoop.hbase.nio.ByteBuff; 24 25 /** 26 * A decoding context that is created by a reader's encoder, and is shared 27 * across the reader's all read operations. 28 * 29 * @see HFileBlockEncodingContext for encoding 30 */ 31 @InterfaceAudience.Private 32 public interface HFileBlockDecodingContext { 33 34 /** 35 * Perform all actions that need to be done before the encoder's real decoding 36 * process. Decompression needs to be done if 37 * {@link HFileContext#getCompression()} returns a valid compression 38 * algorithm. 39 * 40 * @param onDiskSizeWithoutHeader 41 * numBytes after block and encoding headers 42 * @param uncompressedSizeWithoutHeader 43 * numBytes without header required to store the block after 44 * decompressing (not decoding) 45 * @param blockBufferWithoutHeader 46 * ByteBuffer pointed after the header but before the data 47 * @param onDiskBlock 48 * on disk data to be decoded 49 * @throws IOException 50 */ 51 void prepareDecoding( 52 int onDiskSizeWithoutHeader, 53 int uncompressedSizeWithoutHeader, 54 ByteBuff blockBufferWithoutHeader, 55 ByteBuff onDiskBlock 56 ) throws IOException; 57 58 /** 59 * @return HFile meta information 60 */ 61 HFileContext getHFileContext(); 62 }