/** * @param pbBytes A pb serialized {@link * org.apache.hadoop.hbase.filter.MultipleColumnPrefixFilter} instance * @return An instance of {@link org.apache.hadoop.hbase.filter.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); }
/** @return The filter serialized using pb */ public byte[] toByteArray() { FilterProtos.MultipleColumnPrefixFilter.Builder builder = FilterProtos.MultipleColumnPrefixFilter.newBuilder(); for (byte[] element : sortedPrefixes) { if (element != null) builder.addSortedPrefixes(ByteStringer.wrap(element)); } return builder.build().toByteArray(); }