本文整理汇总了Java中org.apache.hadoop.hbase.protobuf.generated.FilterProtos类的典型用法代码示例。如果您正苦于以下问题:Java FilterProtos类的具体用法?Java FilterProtos怎么用?Java FilterProtos使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FilterProtos类属于org.apache.hadoop.hbase.protobuf.generated包,在下文中一共展示了FilterProtos类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: toFilter
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; //导入依赖的package包/类
/**
* Convert a protocol buffer Filter to a client Filter
*
* @param proto the protocol buffer Filter to convert
* @return the converted Filter
*/
@SuppressWarnings("unchecked")
public static Filter toFilter(FilterProtos.Filter proto) throws IOException {
String type = proto.getName();
final byte [] value = proto.getSerializedFilter().toByteArray();
String funcName = "parseFrom";
try {
Class<? extends Filter> c =
(Class<? extends Filter>)Class.forName(type, true, CLASS_LOADER);
Method parseFrom = c.getMethod(funcName, byte[].class);
if (parseFrom == null) {
throw new IOException("Unable to locate function: " + funcName + " in type: " + type);
}
return (Filter)parseFrom.invoke(c, value);
} catch (Exception e) {
// Either we couldn't instantiate the method object, or "parseFrom" failed.
// In either case, let's not retry.
throw new DoNotRetryIOException(e);
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:26,代码来源:ProtobufUtil.java
示例2: parseFrom
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; //导入依赖的package包/类
/**
* @param pbBytes A pb serialized {@link FirstKeyValueMatchingQualifiersFilter} instance
* @return An instance of {@link FirstKeyValueMatchingQualifiersFilter} made from <code>bytes</code>
* @throws DeserializationException
* @see #toByteArray
*/
public static FirstKeyValueMatchingQualifiersFilter parseFrom(final byte [] pbBytes)
throws DeserializationException {
FilterProtos.FirstKeyValueMatchingQualifiersFilter proto;
try {
proto = FilterProtos.FirstKeyValueMatchingQualifiersFilter.parseFrom(pbBytes);
} catch (InvalidProtocolBufferException e) {
throw new DeserializationException(e);
}
TreeSet<byte []> qualifiers = new TreeSet<byte []>(Bytes.BYTES_COMPARATOR);
for (ByteString qualifier : proto.getQualifiersList()) {
qualifiers.add(qualifier.toByteArray());
}
return new FirstKeyValueMatchingQualifiersFilter(qualifiers);
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:22,代码来源:FirstKeyValueMatchingQualifiersFilter.java
示例3: parseFrom
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; //导入依赖的package包/类
/**
* @param pbBytes A pb serialized {@link QualifierFilter} instance
* @return An instance of {@link QualifierFilter} made from <code>bytes</code>
* @throws org.apache.hadoop.hbase.exceptions.DeserializationException
* @see #toByteArray
*/
public static QualifierFilter parseFrom(final byte [] pbBytes)
throws DeserializationException {
FilterProtos.QualifierFilter proto;
try {
proto = FilterProtos.QualifierFilter.parseFrom(pbBytes);
} catch (InvalidProtocolBufferException e) {
throw new DeserializationException(e);
}
final CompareOp valueCompareOp =
CompareOp.valueOf(proto.getCompareFilter().getCompareOp().name());
ByteArrayComparable valueComparator = null;
try {
if (proto.getCompareFilter().hasComparator()) {
valueComparator = ProtobufUtil.toComparator(proto.getCompareFilter().getComparator());
}
} catch (IOException ioe) {
throw new DeserializationException(ioe);
}
return new QualifierFilter(valueCompareOp,valueComparator);
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:27,代码来源:QualifierFilter.java
示例4: toByteArray
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; //导入依赖的package包/类
/**
* @return The filter serialized using pb
*/
public byte[] toByteArray() {
FilterProtos.MultiRowRangeFilter.Builder builder = FilterProtos.MultiRowRangeFilter
.newBuilder();
for (RowRange range : rangeList) {
if (range != null) {
FilterProtos.RowRange.Builder rangebuilder = FilterProtos.RowRange.newBuilder();
if (range.startRow != null)
rangebuilder.setStartRow(ByteStringer.wrap(range.startRow));
rangebuilder.setStartRowInclusive(range.startRowInclusive);
if (range.stopRow != null)
rangebuilder.setStopRow(ByteStringer.wrap(range.stopRow));
rangebuilder.setStopRowInclusive(range.stopRowInclusive);
range.isScan = Bytes.equals(range.startRow, range.stopRow) ? 1 : 0;
builder.addRowRangeList(rangebuilder.build());
}
}
return builder.build().toByteArray();
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:22,代码来源:MultiRowRangeFilter.java
示例5: parseFrom
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; //导入依赖的package包/类
/**
* @param pbBytes A pb serialized {@link DependentColumnFilter} instance
* @return An instance of {@link DependentColumnFilter} made from <code>bytes</code>
* @throws DeserializationException
* @see #toByteArray
*/
public static DependentColumnFilter parseFrom(final byte [] pbBytes)
throws DeserializationException {
FilterProtos.DependentColumnFilter proto;
try {
proto = FilterProtos.DependentColumnFilter.parseFrom(pbBytes);
} catch (InvalidProtocolBufferException e) {
throw new DeserializationException(e);
}
final CompareOp valueCompareOp =
CompareOp.valueOf(proto.getCompareFilter().getCompareOp().name());
ByteArrayComparable valueComparator = null;
try {
if (proto.getCompareFilter().hasComparator()) {
valueComparator = ProtobufUtil.toComparator(proto.getCompareFilter().getComparator());
}
} catch (IOException ioe) {
throw new DeserializationException(ioe);
}
return new DependentColumnFilter(
proto.hasColumnFamily()?proto.getColumnFamily().toByteArray():null,
proto.hasColumnQualifier()?proto.getColumnQualifier().toByteArray():null,
proto.getDropDependentColumn(), valueCompareOp, valueComparator);
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:DependentColumnFilter.java
示例6: parseFrom
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; //导入依赖的package包/类
/**
* @param pbBytes A pb serialized {@link RowFilter} instance
* @return An instance of {@link RowFilter} made from <code>bytes</code>
* @throws DeserializationException
* @see #toByteArray
*/
public static RowFilter parseFrom(final byte [] pbBytes)
throws DeserializationException {
FilterProtos.RowFilter proto;
try {
proto = FilterProtos.RowFilter.parseFrom(pbBytes);
} catch (InvalidProtocolBufferException e) {
throw new DeserializationException(e);
}
final CompareOp valueCompareOp =
CompareOp.valueOf(proto.getCompareFilter().getCompareOp().name());
ByteArrayComparable valueComparator = null;
try {
if (proto.getCompareFilter().hasComparator()) {
valueComparator = ProtobufUtil.toComparator(proto.getCompareFilter().getComparator());
}
} catch (IOException ioe) {
throw new DeserializationException(ioe);
}
return new RowFilter(valueCompareOp,valueComparator);
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:27,代码来源:RowFilter.java
示例7: parseFrom
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; //导入依赖的package包/类
/**
* @param pbBytes A pb serialized {@link ValueFilter} instance
* @return An instance of {@link ValueFilter} made from <code>bytes</code>
* @throws DeserializationException
* @see #toByteArray
*/
public static ValueFilter parseFrom(final byte [] pbBytes)
throws DeserializationException {
FilterProtos.ValueFilter proto;
try {
proto = FilterProtos.ValueFilter.parseFrom(pbBytes);
} catch (InvalidProtocolBufferException e) {
throw new DeserializationException(e);
}
final CompareOp valueCompareOp =
CompareOp.valueOf(proto.getCompareFilter().getCompareOp().name());
ByteArrayComparable valueComparator = null;
try {
if (proto.getCompareFilter().hasComparator()) {
valueComparator = ProtobufUtil.toComparator(proto.getCompareFilter().getComparator());
}
} catch (IOException ioe) {
throw new DeserializationException(ioe);
}
return new ValueFilter(valueCompareOp,valueComparator);
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:27,代码来源:ValueFilter.java
示例8: parseFrom
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; //导入依赖的package包/类
/**
* @param pbBytes A pb serialized {@link FilterList} instance
* @return An instance of {@link FilterList} made from <code>bytes</code>
* @throws DeserializationException
* @see #toByteArray
*/
public static FilterList parseFrom(final byte [] pbBytes)
throws DeserializationException {
FilterProtos.FilterList proto;
try {
proto = FilterProtos.FilterList.parseFrom(pbBytes);
} catch (InvalidProtocolBufferException e) {
throw new DeserializationException(e);
}
List<Filter> rowFilters = new ArrayList<Filter>(proto.getFiltersCount());
try {
List<org.apache.hadoop.hbase.protobuf.generated.FilterProtos.Filter> filtersList =
proto.getFiltersList();
int listSize = filtersList.size();
for (int i = 0; i < listSize; i++) {
rowFilters.add(ProtobufUtil.toFilter(filtersList.get(i)));
}
} catch (IOException ioe) {
throw new DeserializationException(ioe);
}
return new FilterList(Operator.valueOf(proto.getOperator().name()),rowFilters);
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:29,代码来源:FilterList.java
示例9: parseFrom
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; //导入依赖的package包/类
/**
* @param pbBytes A pb serialized {@link FuzzyRowFilter} instance
* @return An instance of {@link FuzzyRowFilter} made from <code>bytes</code>
* @throws DeserializationException
* @see #toByteArray
*/
public static FuzzyRowFilter parseFrom(final byte[] pbBytes) throws DeserializationException {
FilterProtos.FuzzyRowFilter proto;
try {
proto = FilterProtos.FuzzyRowFilter.parseFrom(pbBytes);
} catch (InvalidProtocolBufferException e) {
throw new DeserializationException(e);
}
int count = proto.getFuzzyKeysDataCount();
ArrayList<Pair<byte[], byte[]>> fuzzyKeysData = new ArrayList<Pair<byte[], byte[]>>(count);
for (int i = 0; i < count; ++i) {
BytesBytesPair current = proto.getFuzzyKeysData(i);
byte[] keyBytes = current.getFirst().toByteArray();
byte[] keyMeta = current.getSecond().toByteArray();
fuzzyKeysData.add(new Pair<byte[], byte[]>(keyBytes, keyMeta));
}
return new FuzzyRowFilter(fuzzyKeysData);
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:24,代码来源:FuzzyRowFilter.java
示例10: convert
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; //导入依赖的package包/类
FilterProtos.SingleColumnValueFilter convert() {
FilterProtos.SingleColumnValueFilter.Builder builder =
FilterProtos.SingleColumnValueFilter.newBuilder();
if (this.columnFamily != null) {
builder.setColumnFamily(ByteStringer.wrap(this.columnFamily));
}
if (this.columnQualifier != null) {
builder.setColumnQualifier(ByteStringer.wrap(this.columnQualifier));
}
HBaseProtos.CompareType compareOp = CompareType.valueOf(this.compareOp.name());
builder.setCompareOp(compareOp);
builder.setComparator(ProtobufUtil.toComparator(this.comparator));
builder.setFilterIfMissing(this.filterIfMissing);
builder.setLatestVersionOnly(this.latestVersionOnly);
return builder.build();
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:SingleColumnValueFilter.java
示例11: parseFrom
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; //导入依赖的package包/类
/**
* @param pbBytes A pb serialized {@link SingleColumnValueFilter} instance
* @return An instance of {@link SingleColumnValueFilter} made from <code>bytes</code>
* @throws org.apache.hadoop.hbase.exceptions.DeserializationException
* @see #toByteArray
*/
public static SingleColumnValueFilter parseFrom(final byte [] pbBytes)
throws DeserializationException {
FilterProtos.SingleColumnValueFilter proto;
try {
proto = FilterProtos.SingleColumnValueFilter.parseFrom(pbBytes);
} catch (InvalidProtocolBufferException e) {
throw new DeserializationException(e);
}
final CompareOp compareOp =
CompareOp.valueOf(proto.getCompareOp().name());
final ByteArrayComparable comparator;
try {
comparator = ProtobufUtil.toComparator(proto.getComparator());
} catch (IOException ioe) {
throw new DeserializationException(ioe);
}
return new SingleColumnValueFilter(proto.hasColumnFamily() ? proto.getColumnFamily()
.toByteArray() : null, proto.hasColumnQualifier() ? proto.getColumnQualifier()
.toByteArray() : null, compareOp, comparator, proto.getFilterIfMissing(), proto
.getLatestVersionOnly());
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:SingleColumnValueFilter.java
示例12: parseFrom
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; //导入依赖的package包/类
/**
* @param pbBytes A pb serialized {@link FamilyFilter} instance
* @return An instance of {@link FamilyFilter} made from <code>bytes</code>
* @throws DeserializationException
* @see #toByteArray
*/
public static FamilyFilter parseFrom(final byte [] pbBytes)
throws DeserializationException {
FilterProtos.FamilyFilter proto;
try {
proto = FilterProtos.FamilyFilter.parseFrom(pbBytes);
} catch (InvalidProtocolBufferException e) {
throw new DeserializationException(e);
}
final CompareOp valueCompareOp =
CompareOp.valueOf(proto.getCompareFilter().getCompareOp().name());
ByteArrayComparable valueComparator = null;
try {
if (proto.getCompareFilter().hasComparator()) {
valueComparator = ProtobufUtil.toComparator(proto.getCompareFilter().getComparator());
}
} catch (IOException ioe) {
throw new DeserializationException(ioe);
}
return new FamilyFilter(valueCompareOp,valueComparator);
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:27,代码来源:FamilyFilter.java
示例13: parseFrom
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; //导入依赖的package包/类
/**
* @param pbBytes A pb serialized {@link MultipleColumnPrefixFilter} instance
* @return An instance of {@link MultipleColumnPrefixFilter} made from <code>bytes</code>
* @throws DeserializationException
* @see #toByteArray
*/
public static MultipleColumnPrefixFilter parseFrom(final byte [] pbBytes)
throws DeserializationException {
FilterProtos.MultipleColumnPrefixFilter proto;
try {
proto = FilterProtos.MultipleColumnPrefixFilter.parseFrom(pbBytes);
} catch (InvalidProtocolBufferException e) {
throw new DeserializationException(e);
}
int numPrefixes = proto.getSortedPrefixesCount();
byte [][] prefixes = new byte[numPrefixes][];
for (int i = 0; i < numPrefixes; ++i) {
prefixes[i] = proto.getSortedPrefixes(i).toByteArray();
}
return new MultipleColumnPrefixFilter(prefixes);
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:23,代码来源:MultipleColumnPrefixFilter.java
示例14: parseFrom
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; //导入依赖的package包/类
/**
* @param pbBytes A pb serialized {@link SingleColumnValueExcludeFilter} instance
* @return An instance of {@link SingleColumnValueExcludeFilter} made from <code>bytes</code>
* @throws DeserializationException
* @see #toByteArray
*/
public static SingleColumnValueExcludeFilter parseFrom(final byte [] pbBytes)
throws DeserializationException {
FilterProtos.SingleColumnValueExcludeFilter proto;
try {
proto = FilterProtos.SingleColumnValueExcludeFilter.parseFrom(pbBytes);
} catch (InvalidProtocolBufferException e) {
throw new DeserializationException(e);
}
FilterProtos.SingleColumnValueFilter parentProto = proto.getSingleColumnValueFilter();
final CompareOp compareOp =
CompareOp.valueOf(parentProto.getCompareOp().name());
final ByteArrayComparable comparator;
try {
comparator = ProtobufUtil.toComparator(parentProto.getComparator());
} catch (IOException ioe) {
throw new DeserializationException(ioe);
}
return new SingleColumnValueExcludeFilter(parentProto.hasColumnFamily() ? parentProto
.getColumnFamily().toByteArray() : null, parentProto.hasColumnQualifier() ? parentProto
.getColumnQualifier().toByteArray() : null, compareOp, comparator, parentProto
.getFilterIfMissing(), parentProto.getLatestVersionOnly());
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:31,代码来源:SingleColumnValueExcludeFilter.java
示例15: convert
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; //导入依赖的package包/类
public FilterProtos.SingleColumnValueFilter convert() {
FilterProtos.SingleColumnValueFilter.Builder builder =
FilterProtos.SingleColumnValueFilter.newBuilder();
if (this.columnFamily != null) {
builder.setColumnFamily(HBaseZeroCopyByteString.wrap(this.columnFamily));
}
if (this.columnQualifier != null) {
builder.setColumnQualifier(HBaseZeroCopyByteString.wrap(this.columnQualifier));
}
HBaseProtos.CompareType compareOp = CompareType.valueOf(this.compareOp.name());
builder.setCompareOp(compareOp);
builder.setComparator(ProtobufUtil.toComparator(this.comparator));
builder.setFilterIfMissing(this.filterIfMissing);
builder.setLatestVersionOnly(this.latestVersionOnly);
return builder.build();
}
开发者ID:tenggyut,项目名称:HIndex,代码行数:18,代码来源:SingleColumnValueFilter.java
示例16: parseFrom
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; //导入依赖的package包/类
/**
* @param pbBytes A pb serialized {@link FuzzyRowFilter} instance
* @return An instance of {@link FuzzyRowFilter} made from <code>bytes</code>
* @throws DeserializationException
* @see #toByteArray
*/
public static FuzzyRowFilter parseFrom(final byte [] pbBytes)
throws DeserializationException {
FilterProtos.FuzzyRowFilter proto;
try {
proto = FilterProtos.FuzzyRowFilter.parseFrom(pbBytes);
} catch (InvalidProtocolBufferException e) {
throw new DeserializationException(e);
}
int count = proto.getFuzzyKeysDataCount();
ArrayList<Pair<byte[], byte[]>> fuzzyKeysData= new ArrayList<Pair<byte[], byte[]>>(count);
for (int i = 0; i < count; ++i) {
BytesBytesPair current = proto.getFuzzyKeysData(i);
byte[] keyBytes = current.getFirst().toByteArray();
byte[] keyMeta = current.getSecond().toByteArray();
fuzzyKeysData.add(new Pair<byte[], byte[]>(keyBytes, keyMeta));
}
return new FuzzyRowFilter(fuzzyKeysData);
}
开发者ID:grokcoder,项目名称:pbase,代码行数:25,代码来源:FuzzyRowFilter.java
示例17: toFilter
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; //导入依赖的package包/类
/**
* Convert a protocol buffer Filter to a client Filter
*
* @param proto the protocol buffer Filter to convert
* @return the converted Filter
*/
@SuppressWarnings("unchecked")
public static Filter toFilter(FilterProtos.Filter proto) throws IOException {
String type = proto.getName();
final byte [] value = proto.getSerializedFilter().toByteArray();
String funcName = "parseFrom";
try {
Class<? extends Filter> c =
(Class<? extends Filter>)Class.forName(type, true, CLASS_LOADER);
Method parseFrom = c.getMethod(funcName, byte[].class);
if (parseFrom == null) {
throw new IOException("Unable to locate function: " + funcName + " in type: " + type);
}
return (Filter)parseFrom.invoke(c, value);
} catch (Exception e) {
throw new IOException(e);
}
}
开发者ID:tenggyut,项目名称:HIndex,代码行数:24,代码来源:ProtobufUtil.java
示例18: parseFrom
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; //导入依赖的package包/类
/**
* @param pbBytes A pb serialized {@link FilterList} instance
* @return An instance of {@link FilterList} made from <code>bytes</code>
* @throws DeserializationException
* @see #toByteArray
*/
public static FilterList parseFrom(final byte [] pbBytes)
throws DeserializationException {
FilterProtos.FilterList proto;
try {
proto = FilterProtos.FilterList.parseFrom(pbBytes);
} catch (InvalidProtocolBufferException e) {
throw new DeserializationException(e);
}
List<Filter> rowFilters = new ArrayList<Filter>(proto.getFiltersCount());
try {
for (FilterProtos.Filter filter : proto.getFiltersList()) {
rowFilters.add(ProtobufUtil.toFilter(filter));
}
} catch (IOException ioe) {
throw new DeserializationException(ioe);
}
return new FilterList(Operator.valueOf(proto.getOperator().name()),rowFilters);
}
开发者ID:tenggyut,项目名称:HIndex,代码行数:26,代码来源:FilterList.java
示例19: serializeFilter
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; //导入依赖的package包/类
public static byte[] serializeFilter(Filter filter) {
if (filter == null) {
return null;
}
try {
FilterProtos.Filter pbFilter = ProtobufUtil.toFilter(filter);
return pbFilter.toByteArray();
} catch (IOException e) {
throw new DrillRuntimeException("Error serializing filter: " + filter, e);
}
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:12,代码来源:HBaseUtils.java
示例20: deserializeFilter
import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; //导入依赖的package包/类
public static Filter deserializeFilter(byte[] filterBytes) {
if (filterBytes == null) {
return null;
}
try {
FilterProtos.Filter pbFilter = FilterProtos.Filter.parseFrom(filterBytes);
return ProtobufUtil.toFilter(pbFilter);
} catch (Exception e) {
throw new DrillRuntimeException("Error deserializing filter: " + filterBytes, e);
}
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:12,代码来源:HBaseUtils.java
注:本文中的org.apache.hadoop.hbase.protobuf.generated.FilterProtos类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论