001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.hbase;
019
020import java.io.IOException;
021import java.io.OutputStream;
022import org.apache.yetus.audience.InterfaceAudience;
023
024/**
025 * This class is an extension to ContentSizeCachedKeyValue where there are no tags in Cell. Note:
026 * Please do not use these objects in write path as it will increase the heap space usage. See
027 * https://issues.apache.org/jira/browse/HBASE-13448
028 */
029@InterfaceAudience.Private
030public class SizeCachedNoTagsKeyValue extends SizeCachedKeyValue {
031
032  public SizeCachedNoTagsKeyValue(byte[] bytes, int offset, int length, long seqId, int keyLen) {
033    super(bytes, offset, length, seqId, keyLen);
034  }
035
036  public SizeCachedNoTagsKeyValue(byte[] bytes, int offset, int length, long seqId, int keyLen,
037    short rowLen) {
038    super(bytes, offset, length, seqId, keyLen, rowLen);
039  }
040
041  @Override
042  public int getTagsLength() {
043    return 0;
044  }
045
046  @Override
047  public int write(OutputStream out, boolean withTags) throws IOException {
048    out.write(this.bytes, this.offset, this.length);
049    return this.length;
050  }
051
052  @Override
053  public int getSerializedSize(boolean withTags) {
054    return this.length;
055  }
056}