org.apache.hadoop.hbase.util.Base64.decode()方法的使用及代码示例

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

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

Base64.decode介绍

[英]Decodes data from Base64 notation, automatically detecting gzip-compressed data and decompressing it.
[中]对Base64符号中的数据进行解码,自动检测gzip压缩数据并对其进行解压缩。

代码示例

代码示例来源:origin: forcedotcom/phoenix

@Override
public Object toObject(String value) {
  if (value == null || value.length() == 0) {
    return null;
  }
  return Base64.decode(value);
}

代码示例来源:origin: forcedotcom/phoenix

@Override
public Object toObject(String value) {
  if (value == null || value.length() == 0) {
    return null;
  }
  return Base64.decode(value);
}

代码示例来源:origin: com.aliyun.hbase/alihbase-common

/**
 * Decodes data from Base64 notation, automatically detecting gzip-compressed
 * data and decompressing it.
 *
 * @param s the string to decode
 * @return the decoded data
 * @since 1.4
 */
public static byte[] decode(String s) {
 return decode(s, NO_OPTIONS);
}

代码示例来源:origin: co.cask.hbase/hbase

/**
 * Decodes data from Base64 notation, automatically detecting gzip-compressed
 * data and decompressing it.
 *
 * @param s the string to decode
 * @return the decoded data
 * @since 1.4
 */
public static byte[] decode(String s) {
 return decode(s, NO_OPTIONS);
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Decodes data from Base64 notation, automatically detecting gzip-compressed
 * data and decompressing it.
 *
 * @param s the string to decode
 * @return the decoded data
 * @since 1.4
 */
public static byte[] decode(String s) {
 return decode(s, NO_OPTIONS);
}

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

public static byte[] getIndexMaintainers(final Configuration configuration){
  Preconditions.checkNotNull(configuration);
  return Base64.decode(configuration.get(INDEX_MAINTAINERS));
}

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

@VisibleForTesting
static Character getCharacter(Configuration conf, String confKey) {
  String strValue = conf.get(confKey);
  if (strValue == null) {
    return null;
  }
  return new String(Base64.decode(strValue)).charAt(0);
}

代码示例来源:origin: co.cask.hbase/hbase

private static byte[] getKeyFromConf(Configuration conf,
  String base64Key, String deprecatedKey) {
 String encoded = conf.get(base64Key);
 if (encoded != null) {
  return Base64.decode(encoded);
 }
 String oldStyleVal = conf.get(deprecatedKey);
 if (oldStyleVal == null) {
  return null;
 }
 LOG.warn("Using deprecated configuration " + deprecatedKey +
   " - please use static accessor methods instead.");
 return Bytes.toBytes(oldStyleVal);
}

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

@Override
public Object toObject(String value) {
  if (value == null || value.length() == 0) {
    return null;
  }
  Object object = Base64.decode(value);
  if (object == null) { throw newIllegalDataException(
      "Input: [" + value + "]  is not base64 encoded"); }
  return object;
}

代码示例来源:origin: com.aliyun.hbase/alihbase-mapreduce

private static byte[] getKeyFromConf(Configuration conf,
  String base64Key, String deprecatedKey) {
 String encoded = conf.get(base64Key);
 if (encoded != null) {
  return Base64.decode(encoded);
 }
 String oldStyleVal = conf.get(deprecatedKey);
 if (oldStyleVal == null) {
  return null;
 }
 LOG.warn("Using deprecated configuration " + deprecatedKey +
   " - please use static accessor methods instead.");
 return Bytes.toBytesBinary(oldStyleVal);
}

代码示例来源:origin: co.cask.hbase/hbase

/**
 * Converts the given Base64 string back into a Scan instance.
 *
 * @param base64  The scan details.
 * @return The newly created Scan instance.
 * @throws IOException When reading the scan instance fails.
 */
static Scan convertStringToScan(String base64) throws IOException {
 ByteArrayInputStream bis = new ByteArrayInputStream(Base64.decode(base64));
 DataInputStream dis = new DataInputStream(bis);
 Scan scan = new Scan();
 scan.readFields(dis);
 return scan;
}

代码示例来源:origin: harbby/presto-connectors

private static byte[] getKeyFromConf(Configuration conf,
  String base64Key, String deprecatedKey) {
 String encoded = conf.get(base64Key);
 if (encoded != null) {
  return Base64.decode(encoded);
 }
 String oldStyleVal = conf.get(deprecatedKey);
 if (oldStyleVal == null) {
  return null;
 }
 LOG.warn("Using deprecated configuration " + deprecatedKey +
   " - please use static accessor methods instead.");
 return Bytes.toBytes(oldStyleVal);
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Handles common parameter initialization that a subclass might want to leverage.
 * @param context
 */
protected void doSetup(Context context) {
 Configuration conf = context.getConfiguration();
 // If a custom separator has been used,
 // decode it back from Base64 encoding.
 separator = conf.get(ImportTsv.SEPARATOR_CONF_KEY);
 if (separator == null) {
  separator = ImportTsv.DEFAULT_SEPARATOR;
 } else {
  separator = new String(Base64.decode(separator));
 }
 skipBadLines = context.getConfiguration().getBoolean(ImportTsv.SKIP_LINES_CONF_KEY, true);
 badLineCount = context.getCounter("ImportTsv", "Bad Lines");
}

代码示例来源:origin: com.aliyun.hbase/alihbase-mapreduce

/**
 * Handles common parameter initialization that a subclass might want to leverage.
 * @param context
 */
protected void doSetup(Context context) {
 Configuration conf = context.getConfiguration();
 // If a custom separator has been used,
 // decode it back from Base64 encoding.
 separator = conf.get(ImportTsv.SEPARATOR_CONF_KEY);
 if (separator == null) {
  separator = ImportTsv.DEFAULT_SEPARATOR;
 } else {
  separator = new String(Base64.decode(separator));
 }
 skipBadLines = context.getConfiguration().getBoolean(ImportTsv.SKIP_LINES_CONF_KEY, true);
 logBadLines = context.getConfiguration().getBoolean(ImportTsv.LOG_BAD_LINES_CONF_KEY, false);
 badLineCount = context.getCounter("ImportTsv", "Bad Lines");
}

代码示例来源:origin: com.aliyun.hbase/alihbase-mapreduce

/**
 * Converts the given Base64 string back into a Scan instance.
 *
 * @param base64  The scan details.
 * @return The newly created Scan instance.
 * @throws IOException When reading the scan instance fails.
 */
public static Scan convertStringToScan(String base64) throws IOException {
 byte [] decoded = Base64.decode(base64);
 return ProtobufUtil.toScan(ClientProtos.Scan.parseFrom(decoded));
}

代码示例来源:origin: sematext/HBaseHUT

/**
 * Converts the given Base64 string back into a UpdateProcessor instance.
 *
 * @param upClassName  The updateProcessor class name.
 * @param base64  The updateProcessor details.
 * @return The newly created updateProcessor instance.
 * @throws java.io.IOException When reading the updateProcessor instance fails.
 */
static UpdateProcessor convertStringToUpdateProcessor(String upClassName, String base64)
    throws IOException {
 UpdateProcessor up = createInstance(upClassName, UpdateProcessor.class);
 if (base64 != null) {
  ByteArrayInputStream bis = new ByteArrayInputStream(Base64.decode(base64));
  DataInputStream dis = new DataInputStream(bis);
  up.readFields(dis);
 }
 return up;
}

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

public static Scan convertStringToScan(String string) throws IOException {
 ClientProtos.Scan proto = ClientProtos.Scan.parseFrom(Base64.decode(string));
 return ProtobufUtil.toScan(proto);
}

代码示例来源:origin: com.aliyun.hbase/alihbase-rest

protected T fromPB(String pb) throws
  Exception {
 return (T)clazz.getMethod("getObjectFromMessage", byte[].class).invoke(
   clazz.getDeclaredConstructor().newInstance(),
   Base64.decode(AS_PB));
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Converts the given Base64 string back into a Scan instance.
 *
 * @param base64  The scan details.
 * @return The newly created Scan instance.
 * @throws IOException When reading the scan instance fails.
 */
static Scan convertStringToScan(String base64) throws IOException {
 byte [] decoded = Base64.decode(base64);
 ClientProtos.Scan scan;
 try {
  scan = ClientProtos.Scan.parseFrom(decoded);
 } catch (InvalidProtocolBufferException ipbe) {
  throw new IOException(ipbe);
 }
 return ProtobufUtil.toScan(scan);
}

代码示例来源:origin: mozilla-metrics/akela

/**
 * Converts base64 scans string back into a Scan array
 * @param base64
 * @return
 * @throws IOException
 */
public static Scan[] convertStringToScanArray(final String base64) throws IOException {
  final DataInputStream dis = new DataInputStream(new ByteArrayInputStream(Base64.decode(base64)));
  ArrayWritable aw = new ArrayWritable(Scan.class);
  aw.readFields(dis);
  
  Writable[] writables = aw.get();
  Scan[] scans = new Scan[writables.length];
  for (int i=0; i < writables.length; i++) {
    scans[i] = (Scan)writables[i];
  }
  return scans;
}

相关文章