当前位置: 首页>>代码示例>>Java>>正文


Java ByteBufferUtils.copyBufferToStream方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.util.ByteBufferUtils.copyBufferToStream方法的典型用法代码示例。如果您正苦于以下问题:Java ByteBufferUtils.copyBufferToStream方法的具体用法?Java ByteBufferUtils.copyBufferToStream怎么用?Java ByteBufferUtils.copyBufferToStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.util.ByteBufferUtils的用法示例。


在下文中一共展示了ByteBufferUtils.copyBufferToStream方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: write

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
@Override
public int write(OutputStream out, boolean withTags) throws IOException {
  int lenToWrite = getSerializedSize(withTags);
  ByteBufferUtils.putInt(out, keyBuffer.capacity());
  ByteBufferUtils.putInt(out, valueLength);
  // Write key
  out.write(keyBuffer.array());
  // Write value
  ByteBufferUtils.copyBufferToStream(out, this.valueBuffer, this.valueOffset, this.valueLength);
  if (withTags && this.tagsLength > 0) {
    // 2 bytes tags length followed by tags bytes
    // tags length is serialized with 2 bytes only(short way) even if the type is int.
    // As this is non -ve numbers, we save the sign bit. See HBASE-11437
    out.write((byte) (0xff & (this.tagsLength >> 8)));
    out.write((byte) (0xff & this.tagsLength));
    ByteBufferUtils.copyBufferToStream(out, this.tagsBuffer, this.tagsOffset, this.tagsLength);
  }
  return lenToWrite;
}
 
开发者ID:apache,项目名称:hbase,代码行数:20,代码来源:BufferedDataBlockEncoder.java

示例2: writeRowSkippingBytes

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
/**
 * Writes the row from the given cell to the output stream excluding the common prefix
 * @param out The dataoutputstream to which the data has to be written
 * @param cell The cell whose contents has to be written
 * @param rlength the row length
 * @throws IOException
 */
public static void writeRowSkippingBytes(DataOutputStream out, Cell cell, short rlength,
    int commonPrefix) throws IOException {
  if (cell instanceof ByteBufferExtendedCell) {
    ByteBufferUtils
        .copyBufferToStream((DataOutput) out, ((ByteBufferExtendedCell) cell).getRowByteBuffer(),
            ((ByteBufferExtendedCell) cell).getRowPosition() + commonPrefix,
            rlength - commonPrefix);
  } else {
    out.write(cell.getRowArray(), cell.getRowOffset() + commonPrefix, rlength - commonPrefix);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:19,代码来源:PrivateCellUtil.java

示例3: writeFlatKey

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
/**
 * Writes the Cell's key part as it would have serialized in a KeyValue. The format is <2 bytes
 * rk len><rk><1 byte cf len><cf><qualifier><8 bytes
 * timestamp><1 byte type>
 * @param cell
 * @param out
 * @throws IOException
 */
public static void writeFlatKey(Cell cell, DataOutput out) throws IOException {
  short rowLen = cell.getRowLength();
  byte fLen = cell.getFamilyLength();
  int qLen = cell.getQualifierLength();
  // Using just one if/else loop instead of every time checking before writing every
  // component of cell
  if (cell instanceof ByteBufferExtendedCell) {
    out.writeShort(rowLen);
    ByteBufferUtils.copyBufferToStream(out, ((ByteBufferExtendedCell) cell).getRowByteBuffer(),
      ((ByteBufferExtendedCell) cell).getRowPosition(), rowLen);
    out.writeByte(fLen);
    ByteBufferUtils.copyBufferToStream(out, ((ByteBufferExtendedCell) cell).getFamilyByteBuffer(),
      ((ByteBufferExtendedCell) cell).getFamilyPosition(), fLen);
    ByteBufferUtils
      .copyBufferToStream(out, ((ByteBufferExtendedCell) cell).getQualifierByteBuffer(),
        ((ByteBufferExtendedCell) cell).getQualifierPosition(), qLen);
  } else {
    out.writeShort(rowLen);
    out.write(cell.getRowArray(), cell.getRowOffset(), rowLen);
    out.writeByte(fLen);
    out.write(cell.getFamilyArray(), cell.getFamilyOffset(), fLen);
    out.write(cell.getQualifierArray(), cell.getQualifierOffset(), qLen);
  }
  out.writeLong(cell.getTimestamp());
  out.writeByte(cell.getTypeByte());
}
 
开发者ID:apache,项目名称:hbase,代码行数:35,代码来源:PrivateCellUtil.java

示例4: writeRow

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
/**
 * Writes the row from the given cell to the output stream
 * @param out The outputstream to which the data has to be written
 * @param cell The cell whose contents has to be written
 * @param rlength the row length
 * @throws IOException
 */
public static void writeRow(OutputStream out, Cell cell, short rlength) throws IOException {
  if (cell instanceof ByteBufferExtendedCell) {
    ByteBufferUtils.copyBufferToStream(out, ((ByteBufferExtendedCell) cell).getRowByteBuffer(),
      ((ByteBufferExtendedCell) cell).getRowPosition(), rlength);
  } else {
    out.write(cell.getRowArray(), cell.getRowOffset(), rlength);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:16,代码来源:PrivateCellUtil.java

示例5: writeFamily

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
/**
 * Writes the family from the given cell to the output stream
 * @param out The outputstream to which the data has to be written
 * @param cell The cell whose contents has to be written
 * @param flength the family length
 * @throws IOException
 */
public static void writeFamily(OutputStream out, Cell cell, byte flength) throws IOException {
  if (cell instanceof ByteBufferExtendedCell) {
    ByteBufferUtils.copyBufferToStream(out, ((ByteBufferExtendedCell) cell).getFamilyByteBuffer(),
      ((ByteBufferExtendedCell) cell).getFamilyPosition(), flength);
  } else {
    out.write(cell.getFamilyArray(), cell.getFamilyOffset(), flength);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:16,代码来源:PrivateCellUtil.java

示例6: writeQualifier

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
/**
 * Writes the qualifier from the given cell to the output stream
 * @param out The outputstream to which the data has to be written
 * @param cell The cell whose contents has to be written
 * @param qlength the qualifier length
 * @throws IOException
 */
public static void writeQualifier(OutputStream out, Cell cell, int qlength) throws IOException {
  if (cell instanceof ByteBufferExtendedCell) {
    ByteBufferUtils
      .copyBufferToStream(out, ((ByteBufferExtendedCell) cell).getQualifierByteBuffer(),
        ((ByteBufferExtendedCell) cell).getQualifierPosition(), qlength);
  } else {
    out.write(cell.getQualifierArray(), cell.getQualifierOffset(), qlength);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:17,代码来源:PrivateCellUtil.java

示例7: writeQualifierSkippingBytes

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
/**
 * Writes the qualifier from the given cell to the output stream excluding the common prefix
 * @param out The dataoutputstream to which the data has to be written
 * @param cell The cell whose contents has to be written
 * @param qlength the qualifier length
 * @throws IOException
 */
public static void writeQualifierSkippingBytes(DataOutputStream out, Cell cell, int qlength,
    int commonPrefix) throws IOException {
  if (cell instanceof ByteBufferExtendedCell) {
    ByteBufferUtils.copyBufferToStream((DataOutput) out,
        ((ByteBufferExtendedCell) cell).getQualifierByteBuffer(),
        ((ByteBufferExtendedCell) cell).getQualifierPosition() + commonPrefix,
        qlength - commonPrefix);
  } else {
    out.write(cell.getQualifierArray(), cell.getQualifierOffset() + commonPrefix,
        qlength - commonPrefix);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:20,代码来源:PrivateCellUtil.java

示例8: writeValue

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
/**
 * Writes the value from the given cell to the output stream
 * @param out The outputstream to which the data has to be written
 * @param cell The cell whose contents has to be written
 * @param vlength the value length
 * @throws IOException
 */
public static void writeValue(OutputStream out, Cell cell, int vlength) throws IOException {
  if (cell instanceof ByteBufferExtendedCell) {
    ByteBufferUtils.copyBufferToStream(out, ((ByteBufferExtendedCell) cell).getValueByteBuffer(),
      ((ByteBufferExtendedCell) cell).getValuePosition(), vlength);
  } else {
    out.write(cell.getValueArray(), cell.getValueOffset(), vlength);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:16,代码来源:PrivateCellUtil.java

示例9: writeTags

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
/**
 * Writes the tag from the given cell to the output stream
 * @param out The outputstream to which the data has to be written
 * @param cell The cell whose contents has to be written
 * @param tagsLength the tag length
 * @throws IOException
 */
public static void writeTags(OutputStream out, Cell cell, int tagsLength) throws IOException {
  if (cell instanceof ByteBufferExtendedCell) {
    ByteBufferUtils.copyBufferToStream(out, ((ByteBufferExtendedCell) cell).getTagsByteBuffer(),
      ((ByteBufferExtendedCell) cell).getTagsPosition(), tagsLength);
  } else {
    out.write(cell.getTagsArray(), cell.getTagsOffset(), tagsLength);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:16,代码来源:PrivateCellUtil.java

示例10: writeQualifierSkippingBytes

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
/**
 * Writes the qualifier from the given cell to the output stream excluding the common prefix
 * @param out The dataoutputstream to which the data has to be written
 * @param cell The cell whose contents has to be written
 * @param qlength the qualifier length
 * @throws IOException
 * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.
 */
@Deprecated
public static void writeQualifierSkippingBytes(DataOutputStream out, Cell cell,
    int qlength, int commonPrefix) throws IOException {
  if (cell instanceof ByteBufferExtendedCell) {
    ByteBufferUtils.copyBufferToStream((DataOutput)out,
        ((ByteBufferExtendedCell) cell).getQualifierByteBuffer(),
        ((ByteBufferExtendedCell) cell).getQualifierPosition() + commonPrefix,
        qlength - commonPrefix);
  } else {
    out.write(cell.getQualifierArray(), cell.getQualifierOffset() + commonPrefix,
      qlength - commonPrefix);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:22,代码来源:CellUtil.java

示例11: write

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
/**
 * Helper methods to write the dictionary data to the OutputStream
 * @param out the outputstream to which data needs to be written
 * @param data the data to be written in ByteBuffer
 * @param offset the offset
 * @param length length to be written
 * @param dict the dictionary whose contents are to written
 * @throws IOException
 */
public static void write(OutputStream out, ByteBuffer data, int offset, int length,
    Dictionary dict) throws IOException {
  short dictIdx = Dictionary.NOT_IN_DICTIONARY;
  if (dict != null) {
    dictIdx = dict.findEntry(data, offset, length);
  }
  if (dictIdx == Dictionary.NOT_IN_DICTIONARY) {
    out.write(Dictionary.NOT_IN_DICTIONARY);
    StreamUtils.writeRawVInt32(out, length);
    ByteBufferUtils.copyBufferToStream(out, data, offset, length);
  } else {
    StreamUtils.writeShort(out, dictIdx);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:24,代码来源:Dictionary.java

示例12: write

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
@Override
public int write(OutputStream out, boolean withTags) throws IOException {
  int length = getSerializedSize(withTags);
  ByteBufferUtils.copyBufferToStream(out, this.buf, this.offset, length);
  return length;
}
 
开发者ID:apache,项目名称:hbase,代码行数:7,代码来源:ByteBufferKeyValue.java

示例13: write

import org.apache.hadoop.hbase.util.ByteBufferUtils; //导入方法依赖的package包/类
@Override
public void write(ByteBuffer b, int off, int len) throws IOException {
  ByteBufferUtils.copyBufferToStream(out, b, off, len);
  written += len;
}
 
开发者ID:apache,项目名称:hbase,代码行数:6,代码来源:ByteBufferWriterDataOutputStream.java


注:本文中的org.apache.hadoop.hbase.util.ByteBufferUtils.copyBufferToStream方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。