001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with this 004 * work for additional information regarding copyright ownership. The ASF 005 * licenses this file to you under the Apache License, Version 2.0 (the 006 * "License"); you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 013 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 014 * License for the specific language governing permissions and limitations 015 * under the License. 016 */ 017package org.apache.hadoop.hbase.io.encoding; 018 019import java.io.IOException; 020import org.apache.hadoop.hbase.io.hfile.HFileContext; 021import org.apache.hadoop.hbase.nio.ByteBuff; 022import org.apache.yetus.audience.InterfaceAudience; 023 024/** 025 * A decoding context that is created by a reader's encoder, and is shared 026 * across all of the reader's read operations. 027 * 028 * @see HFileBlockEncodingContext for encoding 029 */ 030@InterfaceAudience.Private 031public interface HFileBlockDecodingContext { 032 /** 033 * Perform all actions that need to be done before the encoder's real decoding 034 * process. Decompression needs to be done if 035 * {@link HFileContext#getCompression()} returns a valid compression 036 * algorithm. 037 * 038 * @param onDiskSizeWithoutHeader 039 * numBytes after block and encoding headers 040 * @param uncompressedSizeWithoutHeader 041 * numBytes without header required to store the block after 042 * decompressing (not decoding) 043 * @param blockBufferWithoutHeader 044 * ByteBuffer pointed after the header but before the data 045 * @param onDiskBlock 046 * on disk data to be decoded 047 */ 048 void prepareDecoding( 049 int onDiskSizeWithoutHeader, 050 int uncompressedSizeWithoutHeader, 051 ByteBuff blockBufferWithoutHeader, 052 ByteBuff onDiskBlock 053 ) throws IOException; 054 055 /** 056 * @return HFile meta information 057 */ 058 HFileContext getHFileContext(); 059}