Java 类org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ColumnFamilySchema 实例源码

项目:ditb    文件:IndexColumnDescriptor.java   
@Override
/**
 * @return Convert this instance to a the pb column family type
 */ public ColumnFamilySchema convert() {
  try {
    DataOutputBuffer indexout = new DataOutputBuffer();
    // System.out.println("winter write indexColumn descripter, indexType is: "
    // + valueOfIndexType(indexType));
    indexout.writeInt(valueOfIndexType(indexType));
    indexout.writeInt(indexes.size());
    for (IndexDescriptor indexDescriptor : indexes.values()) {
      indexDescriptor.write(indexout);
    }
    super.setValue(INDEX, indexout.getData());
  } catch (IOException e1) {
    e1.printStackTrace();
  }
  return super.convert();
}
项目:ditb    文件:HColumnDescriptor.java   
/**
 * @param bytes A pb serialized {@link HColumnDescriptor} instance with pb magic prefix
 * @return An instance of {@link HColumnDescriptor} made from <code>bytes</code>
 * @throws DeserializationException
 * @see #toByteArray()
 */
public static HColumnDescriptor parseFrom(final byte [] bytes) throws DeserializationException {
  if (!ProtobufUtil.isPBMagicPrefix(bytes)) throw new DeserializationException("No magic");
  int pblen = ProtobufUtil.lengthOfPBMagic();
  ColumnFamilySchema.Builder builder = ColumnFamilySchema.newBuilder();
  ColumnFamilySchema cfs = null;
  try {
    ProtobufUtil.mergeFrom(builder, bytes, pblen, bytes.length - pblen);
    cfs = builder.build();
  } catch (IOException e) {
    throw new DeserializationException(e);
  }
  return convert(cfs);
}
项目:pbase    文件:HColumnDescriptor.java   
/**
 * @param bytes A pb serialized {@link HColumnDescriptor} instance with pb magic prefix
 * @return An instance of {@link HColumnDescriptor} made from <code>bytes</code>
 * @throws DeserializationException
 * @see #toByteArray()
 */
public static HColumnDescriptor parseFrom(final byte [] bytes) throws DeserializationException {
  if (!ProtobufUtil.isPBMagicPrefix(bytes)) throw new DeserializationException("No magic");
  int pblen = ProtobufUtil.lengthOfPBMagic();
  ColumnFamilySchema.Builder builder = ColumnFamilySchema.newBuilder();
  ColumnFamilySchema cfs = null;
  try {
    cfs = builder.mergeFrom(bytes, pblen, bytes.length - pblen).build();
  } catch (InvalidProtocolBufferException e) {
    throw new DeserializationException(e);
  }
  return convert(cfs);
}
项目:HIndex    文件:HColumnDescriptor.java   
/**
 * @param bytes A pb serialized {@link HColumnDescriptor} instance with pb magic prefix
 * @return An instance of {@link HColumnDescriptor} made from <code>bytes</code>
 * @throws DeserializationException
 * @see #toByteArray()
 */
public static HColumnDescriptor parseFrom(final byte [] bytes) throws DeserializationException {
  if (!ProtobufUtil.isPBMagicPrefix(bytes)) throw new DeserializationException("No magic");
  int pblen = ProtobufUtil.lengthOfPBMagic();
  ColumnFamilySchema.Builder builder = ColumnFamilySchema.newBuilder();
  ColumnFamilySchema cfs = null;
  try {
    cfs = builder.mergeFrom(bytes, pblen, bytes.length - pblen).build();
  } catch (InvalidProtocolBufferException e) {
    throw new DeserializationException(e);
  }
  return convert(cfs);
}
项目:PyroDB    文件:HColumnDescriptor.java   
/**
 * @param bytes A pb serialized {@link HColumnDescriptor} instance with pb magic prefix
 * @return An instance of {@link HColumnDescriptor} made from <code>bytes</code>
 * @throws DeserializationException
 * @see #toByteArray()
 */
public static HColumnDescriptor parseFrom(final byte [] bytes) throws DeserializationException {
  if (!ProtobufUtil.isPBMagicPrefix(bytes)) throw new DeserializationException("No magic");
  int pblen = ProtobufUtil.lengthOfPBMagic();
  ColumnFamilySchema.Builder builder = ColumnFamilySchema.newBuilder();
  ColumnFamilySchema cfs = null;
  try {
    cfs = builder.mergeFrom(bytes, pblen, bytes.length - pblen).build();
  } catch (InvalidProtocolBufferException e) {
    throw new DeserializationException(e);
  }
  return convert(cfs);
}
项目:c5    文件:HColumnDescriptor.java   
/**
 * @param bytes A pb serialized {@link HColumnDescriptor} instance with pb magic prefix
 * @return An instance of {@link HColumnDescriptor} made from <code>bytes</code>
 * @throws DeserializationException
 * @see #toByteArray()
 */
public static HColumnDescriptor parseFrom(final byte [] bytes) throws DeserializationException {
  if (!ProtobufUtil.isPBMagicPrefix(bytes)) throw new DeserializationException("No magic");
  int pblen = ProtobufUtil.lengthOfPBMagic();
  ColumnFamilySchema.Builder builder = ColumnFamilySchema.newBuilder();
  ColumnFamilySchema cfs = null;
  try {
    cfs = builder.mergeFrom(bytes, pblen, bytes.length - pblen).build();
  } catch (InvalidProtocolBufferException e) {
    throw new DeserializationException(e);
  }
  return convert(cfs);
}
项目:DominoHBase    文件:HTableDescriptor.java   
/**
 * @param ts A pb TableSchema instance.
 * @return An {@link HTableDescriptor} made from the passed in pb <code>ts</code>.
 */
public static HTableDescriptor convert(final TableSchema ts) {
  List<ColumnFamilySchema> list = ts.getColumnFamiliesList();
  HColumnDescriptor [] hcds = new HColumnDescriptor[list.size()];
  int index = 0;
  for (ColumnFamilySchema cfs: list) {
    hcds[index++] = HColumnDescriptor.convert(cfs);
  }
  HTableDescriptor htd = new HTableDescriptor(ts.getName().toByteArray(), hcds);
  for (BytesBytesPair a: ts.getAttributesList()) {
    htd.setValue(a.getFirst().toByteArray(), a.getSecond().toByteArray());
  }
  return htd;
}
项目:DominoHBase    文件:HColumnDescriptor.java   
/**
 * @param bytes A pb serialized {@link HColumnDescriptor} instance with pb magic prefix
 * @return An instance of {@link HColumnDescriptor} made from <code>bytes</code>
 * @throws DeserializationException
 * @see #toByteArray()
 */
public static HColumnDescriptor parseFrom(final byte [] bytes) throws DeserializationException {
  if (!ProtobufUtil.isPBMagicPrefix(bytes)) throw new DeserializationException("No magic");
  int pblen = ProtobufUtil.lengthOfPBMagic();
  ColumnFamilySchema.Builder builder = ColumnFamilySchema.newBuilder();
  ColumnFamilySchema cfs = null;
  try {
    cfs = builder.mergeFrom(bytes, pblen, bytes.length - pblen).build();
  } catch (InvalidProtocolBufferException e) {
    throw new DeserializationException(e);
  }
  return convert(cfs);
}
项目:DominoHBase    文件:HColumnDescriptor.java   
/**
 * @param cfs
 * @return An {@link HColumnDescriptor} made from the passed in <code>cfs</code>
 */
public static HColumnDescriptor convert(final ColumnFamilySchema cfs) {
  // Use the empty constructor so we preserve the initial values set on construction for things
  // like maxVersion.  Otherwise, we pick up wrong values on deserialization which makes for
  // unrelated-looking test failures that are hard to trace back to here.
  HColumnDescriptor hcd = new HColumnDescriptor();
  hcd.name = cfs.getName().toByteArray();
  for (BytesBytesPair a: cfs.getAttributesList()) {
    hcd.setValue(a.getFirst().toByteArray(), a.getSecond().toByteArray());
  }
  return hcd;
}
项目:DominoHBase    文件:HColumnDescriptor.java   
/**
 * @return Convert this instance to a the pb column family type
 */
public ColumnFamilySchema convert() {
  ColumnFamilySchema.Builder builder = ColumnFamilySchema.newBuilder();
  builder.setName(ByteString.copyFrom(getName()));
  for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> e: this.values.entrySet()) {
    BytesBytesPair.Builder aBuilder = BytesBytesPair.newBuilder();
    aBuilder.setFirst(ByteString.copyFrom(e.getKey().get()));
    aBuilder.setSecond(ByteString.copyFrom(e.getValue().get()));
    builder.addAttributes(aBuilder.build());
  }
  return builder.build();
}