org.apache.hadoop.hbase.client.Put.toJSON()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(116)

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

Put.toJSON介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

put.addColumn(FAMILY, QUALIFIER, VALUE);
json = put.toJSON();
parsedJSON = mapper.readValue(json, HashMap.class);

代码示例来源:origin: larsgeorge/hbase-book

public static void main(String[] args) throws Exception {
  // vv FingerprintExample
  Put put = new Put(Bytes.toBytes("testrow"));
  put.addColumn(Bytes.toBytes("fam-1"), Bytes.toBytes("qual-1"),
   Bytes.toBytes("val-1"));
  put.addColumn(Bytes.toBytes("fam-1"), Bytes.toBytes("qual-2"),
   Bytes.toBytes("val-2"));
  put.addColumn(Bytes.toBytes("fam-2"), Bytes.toBytes("qual-3"),
   Bytes.toBytes("val-3"));

  String id = String.format("Hostname: %s, App: %s",
   InetAddress.getLocalHost().getHostName(),
   System.getProperty("sun.java.command"));
  put.setId(id);

  System.out.println("Put.size: " + put.size());
  System.out.println("Put.id: " + put.getId());
  System.out.println("Put.fingerprint: " + put.getFingerprint());
  System.out.println("Put.toMap: " + put.toMap());
  System.out.println("Put.toJSON: " + put.toJSON());
  System.out.println("Put.toString: " + put.toString());
  // ^^ FingerprintExample
 }
}

代码示例来源:origin: org.apache.hbase/hbase-client

put.addColumn(FAMILY, QUALIFIER, VALUE);
json = put.toJSON();
parsedJSON = mapper.readValue(json, HashMap.class);

代码示例来源:origin: stackoverflow.com

String str = "prasad\r\nchowdary";

str = StringEscapeUtils.escapeJava(str);

Put p = new Put(Bytes.toBytes(str));

JSONObject json = new JSONObject(p.toJSON());

System.out.println(StringEscapeUtils.unescapeJava(json.getString("row")));

代码示例来源:origin: com.twitter.hraven/hraven-core

/**
 * creates a put to be updated into the RAW table for aggregation status
 * @param row key
 * @param status of aggregation
 * @return {@link Put}
 */
public Put getAggregatedStatusPut(byte[] row, byte[] col, Boolean status) {
 Put put = new Put(row);
 put.addColumn(Constants.INFO_FAM_BYTES, col, Bytes.toBytes(status));
 try {
  LOG.info(" agg status " + status + " and put " + put.toJSON());
 } catch (IOException e) {
  // ignore json exception
 }
 return put;
}

代码示例来源:origin: twitter/hraven

/**
 * creates a put to be updated into the RAW table for aggregation status
 * @param row key
 * @param status of aggregation
 * @return {@link Put}
 */
public Put getAggregatedStatusPut(byte[] row, byte[] col, Boolean status) {
 Put put = new Put(row);
 put.addColumn(Constants.INFO_FAM_BYTES, col, Bytes.toBytes(status));
 try {
  LOG.info(" agg status " + status + " and put " + put.toJSON());
 } catch (IOException e) {
  // ignore json exception
 }
 return put;
}

相关文章