org.apache.fluo.api.data.Bytes.of()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中org.apache.fluo.api.data.Bytes.of()方法的一些代码示例,展示了Bytes.of()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.of()方法的具体详情如下:
包路径:org.apache.fluo.api.data.Bytes
类名称:Bytes
方法名:of

Bytes.of介绍

[英]Creates a Bytes object by copying the data of the CharSequence and encoding it using UTF-8.
[中]通过复制CharSequence的数据并使用UTF-8对其进行编码来创建Bytes对象。

代码示例

代码示例来源:origin: org.apache.fluo/fluo-api

/**
 * Creates Column with a family and qualifier. String parameters will be encoded as UTF-8.
 */
public Column(CharSequence family, CharSequence qualifier) {
 this(Bytes.of(family), Bytes.of(qualifier));
}

代码示例来源:origin: org.apache.fluo/fluo-api

/**
 * @param row (will be UTF-8 encoded)
 * @param val (will be UTF-8 encoded)
 */
public RowColumnValue(CharSequence row, Column col, CharSequence val) {
 this.row = Bytes.of(row);
 this.col = col;
 this.val = Bytes.of(val);
}

代码示例来源:origin: org.apache.fluo/fluo-api

/**
 * Constructs a RowColumn with only a row. Column will be set to Column.EMPTY
 *
 * @param row (will be UTF-8 encoded)
 */
public RowColumn(CharSequence row) {
 this(Bytes.of(row));
}

代码示例来源:origin: org.apache.fluo/fluo-recipes-core

InitializerImpl(String cqId, int numBuckets, SimpleSerializer serializer) {
 this.dataPrefix = Bytes.of(cqId + ":d:");
 this.numBuckets = numBuckets;
 this.serializer = serializer;
}

代码示例来源:origin: org.apache.fluo/fluo-api

/**
 * Constructs a RowColumn
 *
 * @param row Row String (will be UTF-8 encoded)
 * @param col Column
 */
public RowColumn(CharSequence row, Column col) {
 this(Bytes.of(row), col);
}

代码示例来源:origin: org.apache.fluo/fluo-core

/**
 * Convert from Hadoop Text to Bytes
 */
public static Bytes toBytes(Text t) {
 return Bytes.of(t.getBytes(), 0, t.getLength());
}

代码示例来源:origin: org.apache.rya/rya.pcj.fluo.app

/**
 * Creates a Byte row form the query id. The batch id is automatically generated/
 * @param nodeId
 * @return Byte row used to identify the BatchInformation
 */
public static Bytes getRow(String nodeId) {
  String row = new StringBuilder().append(nodeId).append(IncrementalUpdateConstants.NODEID_BS_DELIM)
      .append(UUID.randomUUID().toString().replace("-", "")).toString();
  return Bytes.of(row);
}

代码示例来源:origin: org.apache.fluo/fluo-api

/**
 * Build start of Span starting with row (will be encoded UTF-8)
 */
public StartCFBuilder startRow(CharSequence row) {
 return startRow(Bytes.of(row));
}

代码示例来源:origin: org.apache.fluo/fluo-api

/**
  * Add column qualifier (will be encoded UTF-8) to Span end
  */
 public EndCVBuilder qual(CharSequence cq) {
  return qual(Bytes.of(cq));
 }
}

代码示例来源:origin: org.apache.fluo/fluo-recipes-core

public ColumnsMethods rowsBytes(Collection<byte[]> rows) {
 ArrayList<Bytes> conv = new ArrayList<>();
 for (byte[] row : rows) {
  conv.add(Bytes.of(row));
 }
 return rows(conv);
}

代码示例来源:origin: org.apache.fluo/fluo-api

/**
 * Creates a Span that covers an exact row and {@link Column}. The {@link Column} passed to this
 * method can be constructed without a qualifier or visibility to create a Span at the family or
 * qualifier level. String parameters will be encoded as UTF-8
 */
public static Span exact(CharSequence row, Column col) {
 Objects.requireNonNull(row);
 Objects.requireNonNull(col);
 return exact(Bytes.of(row), col);
}

代码示例来源:origin: org.apache.fluo/fluo-api

/**
 * Returns a Span that covers all columns beginning with a row and {@link Column} prefix. The
 * {@link Column} passed to this method can be constructed without a qualifier or visibility to
 * create a prefix Span at the family or qualifier level. String parameters will be encoded as
 * UTF-8
 */
public static Span prefix(CharSequence row, Column colPrefix) {
 Objects.requireNonNull(row);
 Objects.requireNonNull(colPrefix);
 return prefix(Bytes.of(row), colPrefix);
}

代码示例来源:origin: org.apache.fluo/fluo-api

/**
 * Returns a Span that covers all rows beginning with a prefix String parameters will be encoded
 * as UTF-8
 */
public static Span prefix(CharSequence rowPrefix) {
 Objects.requireNonNull(rowPrefix);
 return prefix(Bytes.of(rowPrefix));
}

代码示例来源:origin: org.apache.fluo/fluo-api

/**
  * Add column family (will be encoded UTF-8) to Span start
  */
 public StartCQBuilder fam(CharSequence cf) {
  return fam(Bytes.of(cf));
 }
}

代码示例来源:origin: org.apache.fluo/fluo-recipes-core

/**
 * @return Returns input with prefix and hash of input prepended.
 */
public Bytes addHash(String row) {
 return addHash(Bytes.of(row));
}

代码示例来源:origin: org.apache.fluo/fluo-core

public ColumnValue entry2cv(Entry<Key, Value> entry) {
 Column col = columnConverter.apply(entry.getKey());
 Bytes val = Bytes.of(entry.getValue().get());
 return new ColumnValue(col, val);
}

代码示例来源:origin: org.apache.fluo/fluo-recipes-core

public Mutator vis(String cv) {
 checkNotSet();
 data.vis = Bytes.of(cv);
 return new Mutator(data);
}

代码示例来源:origin: org.apache.rya/rya.pcj.fluo.app

/**
 * Adds BatchInformation to the {@link FluoQueryColumns#BATCH_COLUMN}.
 * @param tx - Fluo Transaction
 * @param nodeId - query node that batch task will be performed on
 * @param batch - BatchInformation to be processed
 */
public static void addBatch(TransactionBase tx, String nodeId, BatchInformation batch) {
  Bytes row = BatchRowKeyUtil.getRow(nodeId);
  tx.set(row, FluoQueryColumns.BATCH_COLUMN, Bytes.of(BatchInformationSerializer.toBytes(batch)));
}

代码示例来源:origin: org.apache.fluo/fluo-recipes-core

public RowHasher(String prefix) {
 this.prefix = prefix;
 this.prefixBytes = Bytes.of(prefix + ":");
 builders = ThreadLocal.withInitial(() -> {
  BytesBuilder bb = Bytes.builder(prefixBytes.length() + 5 + 32);
  bb.append(prefixBytes);
  return bb;
 });
}

代码示例来源:origin: org.apache.fluo/fluo-recipes-core

public RowColumnValue convert(K key, V val) {
  byte[] k = serializer.serialize(key);
  int hash = Hashing.murmur3_32().hashBytes(k).asInt();
  String bucketId = CombineQueueImpl.genBucketId(Math.abs(hash % numBuckets), numBuckets);

  BytesBuilder bb = Bytes.builder(dataPrefix.length() + bucketId.length() + 1 + k.length);
  Bytes row = bb.append(dataPrefix).append(bucketId).append(':').append(k).toBytes();
  byte[] v = serializer.serialize(val);

  return new RowColumnValue(row, CombineQueueImpl.DATA_COLUMN, Bytes.of(v));
 }
}

相关文章