private static <T> Bytes toBytesOrNull(T t, Function<T, byte[]> f) { if (t == null) { return null; } else { return new Bytes(f.apply(t)); } }
private static <T> Bytes toBytesOrNull(T t, Function<T, byte[]> f) { if (t == null) { return null; } else { return new Bytes(f.apply(t)); } }
@Override public Bytes getValue(Bytes key) { Bytes rval = values.get(key); return rval == null ? null : new Bytes(rval.copyBytes()); }
@Override public byte[] getValue(byte[] key) { Bytes value = values.get(new Bytes(key)); return value == null ? null : value.get(); }
/** * Set the raw crypto key attribute for the family * * @param keyBytes * @return this (for chained invocation) */ public ModifyableColumnFamilyDescriptor setEncryptionKey(byte[] keyBytes) { return setValue(ENCRYPTION_KEY_BYTES, new Bytes(keyBytes)); }
@Override public byte[] getValue(byte[] key) { Bytes value = values.get(new Bytes(key)); return value == null ? null : value.copyBytes(); }
/** * Remove metadata represented by the key from the {@link #values} map * * @param key Key whose key and value we're to remove from TableDescriptor * parameters. * @return the modifyable TD */ public ModifyableTableDescriptor removeValue(final byte[] key) { return removeValue(new Bytes(key)); }
@Override public String get(String key) { Bytes ibw = new Bytes(Bytes .toBytes(key)); if (!m.containsKey(ibw)) return null; Bytes value = m.get(ibw); if (value == null || value.get() == null) return null; return Bytes.toString(value.get()); }
private ModifyableTableDescriptor(final TableName name, final Collection<ColumnFamilyDescriptor> families, Map<Bytes, Bytes> values) { this.name = name; families.forEach(c -> this.families.put(c.getName(), ColumnFamilyDescriptorBuilder.copy(c))); this.values.putAll(values); this.values.put(IS_META_KEY, new Bytes(Bytes.toBytes(Boolean.toString(name.equals(TableName.META_TABLE_NAME))))); }
/** * Add coprocessor to values Map * @param specStr The Coprocessor specification all in in one String * @return Returns <code>this</code> */ private ModifyableTableDescriptor setCoprocessorToMap(final String specStr) { if (specStr == null) { return this; } // generate a coprocessor key int maxCoprocessorNumber = 0; Matcher keyMatcher; for (Map.Entry<Bytes, Bytes> e : this.values.entrySet()) { keyMatcher = CP_HTD_ATTR_KEY_PATTERN.matcher(Bytes.toString(e.getKey().get())); if (!keyMatcher.matches()) { continue; } maxCoprocessorNumber = Math.max(Integer.parseInt(keyMatcher.group(1)), maxCoprocessorNumber); } maxCoprocessorNumber++; String key = "coprocessor$" + Integer.toString(maxCoprocessorNumber); return setValue(new Bytes(Bytes.toBytes(key)), new Bytes(Bytes.toBytes(specStr))); }
private Bytes strToIb(String s) { return new Bytes(Bytes.toBytes(s)); }
@Override public String getValue(String key) { Bytes rval = values.get(new Bytes(Bytes.toBytes(key))); return rval == null ? null : Bytes.toString(rval.get(), rval.getOffset(), rval.getLength()); }
/** * @param key Key whose key and value we're to remove from HCD parameters. */ public void remove(final byte [] key) { getDelegateeForModification().removeValue(new Bytes(key)); }
if (contains(getMethod2Value.values(), str)) { LOG.info("Set to lower case " + str.toLowerCase()); builder2.setValue(k, new Bytes(Bytes.toBytes(str.toLowerCase())));
private static <T extends Mutation> T toDelta(Function<Bytes, T> supplier, ConsumerWithException<T, Cell> consumer, final MutationProto proto, final CellScanner cellScanner) throws IOException { byte[] row = proto.hasRow() ? proto.getRow().toByteArray() : null; T mutation = row == null ? null : supplier.apply(new Bytes(row)); int cellCount = proto.hasAssociatedCellCount() ? proto.getAssociatedCellCount() : 0; if (cellCount > 0) { mutation = supplier.apply(new Bytes(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()));
return new Bytes(cryptoByteStream.getBuffer(), 0, cryptoByteStream.size()); } else { return new Bytes(cryptoByteStream.getBuffer(), 0, cryptoByteStream.size()); compressionStream.flush(); compressionStream.finish(); return new Bytes(compressedByteStream.getBuffer(), 0, compressedByteStream.size()); } else { return null;
private static <T extends Mutation> T toDelta(Function<Bytes, T> supplier, ConsumerWithException<T, Cell> consumer, final MutationProto proto, final CellScanner cellScanner) throws IOException { byte[] row = proto.hasRow() ? proto.getRow().toByteArray() : null; T mutation = row == null ? null : supplier.apply(new Bytes(row)); int cellCount = proto.hasAssociatedCellCount() ? proto.getAssociatedCellCount() : 0; if (cellCount > 0) { mutation = supplier.apply(new Bytes(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()));
@Override public String getValue(String key) { Bytes rval = values.get(new Bytes(Bytes.toBytes(key))); return rval == null ? null : Bytes.toString(rval.get(), rval.getOffset(), rval.getLength()); }
compressAndEncryptDat = new Bytes(baosInMemory.getBuffer(), 0, baosInMemory.size());