2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 package org
.apache
.hadoop
.hbase
.codec
;
20 import java
.io
.InputStream
;
21 import java
.io
.OutputStream
;
23 import org
.apache
.hadoop
.hbase
.CellScanner
;
24 import org
.apache
.hadoop
.hbase
.HBaseInterfaceAudience
;
25 import org
.apache
.hadoop
.hbase
.io
.CellOutputStream
;
26 import org
.apache
.hadoop
.hbase
.nio
.ByteBuff
;
27 import org
.apache
.yetus
.audience
.InterfaceAudience
;
30 * Encoder/Decoder for Cell.
32 * <p>Like {@link org.apache.hadoop.hbase.io.encoding.DataBlockEncoder}
33 * only Cell-based rather than KeyValue version 1 based
34 * and without presuming an hfile context. Intent is an Interface that will work for hfile and
37 @InterfaceAudience.LimitedPrivate({HBaseInterfaceAudience
.COPROC
, HBaseInterfaceAudience
.PHOENIX
})
38 public interface Codec
{
39 // TODO: interfacing with {@link org.apache.hadoop.hbase.io.encoding.DataBlockEncoder}
41 * Call flush when done. Some encoders may not put anything on the stream until flush is called.
42 * On flush, let go of any resources used by the encoder.
44 interface Encoder
extends CellOutputStream
{}
47 * Implementations should implicitly clean up any resources allocated when the
48 * Decoder/CellScanner runs off the end of the cell block. Do this rather than require the user
49 * call close explicitly.
51 interface Decoder
extends CellScanner
{}
53 Decoder
getDecoder(InputStream is
);
54 Decoder
getDecoder(ByteBuff buf
);
55 Encoder
getEncoder(OutputStream os
);