org.elasticsearch.common.Base64.decode()方法的使用及代码示例

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

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

Base64.decode介绍

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

代码示例

代码示例来源:origin: loklak/loklak_server

public byte[] getProfileImage() {
  Object image = this.map.get(field_profile_image);
  if (image == null) return null;
  try {
    return Base64.decode((String) image);
  } catch (IOException e) {
    return null;
  }
}

代码示例来源: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
 * @throws java.io.IOException If there is a problem
 * @since 1.4
 */
public static byte[] decode(String s) throws java.io.IOException {
  return decode(s, NO_OPTIONS);
}

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

/**
   * Low-level access to decoding ASCII characters in
   * the form of a byte array. <strong>Ignores GUNZIP option, if
   * it's set.</strong> This is not generally a recommended method,
   * although it is used internally as part of the decoding process.
   * Special case: if len = 0, an empty array is returned. Still,
   * if you need more speed and reduced memory footprint (and aren't
   * gzipping), consider this method.
   *
   * @param source The Base64 encoded data
   * @return decoded data
   * @since 2.3.1
   */
  public static byte[] decode(byte[] source)
      throws java.io.IOException {
    byte[] decoded = null;
//        try {
    decoded = decode(source, 0, source.length, Base64.NO_OPTIONS);
//        } catch( java.io.IOException ex ) {
//            assert false : "IOExceptions only come from GZipping, which is turned off: " + ex.getMessage();
//        }
    return decoded;
  }

代码示例来源:origin: ujmp/universal-java-matrix-package

public byte[] get(Object key) {
  ElasticsearchSample s = index.get(key);
  if (s == null) {
    return null;
  }
  Object data = s.get(DATA);
  byte[] bytes;
  try {
    bytes = Base64.decode(String.valueOf(data).getBytes());
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
  return bytes;
}

代码示例来源:origin: com.github.tlrx/elasticsearch-view-plugin

@Override
public byte[] render(String view, @Nullable Map<String, Object> vars) {
  byte[] result = new byte[0];
  if (vars != null) {
    Object binary = getBinaryField(view, vars);
    if (binary != null) {
      if (binary instanceof String) {
        try {
          result = Base64.decode((String) binary);
        } catch (IOException e) {
          //todo gérer exception
        }
      }
    }
  }
  return result;
}

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

bytes = decode(bytes, 0, bytes.length, options);

代码示例来源:origin: tlrx/elasticsearch-view-plugin

@Override
public byte[] render(String view, @Nullable Map<String, Object> vars) {
  byte[] result = new byte[0];
  if (vars != null) {
    Object binary = getBinaryField(view, vars);
    if (binary != null) {
      if (binary instanceof String) {
        try {
          result = Base64.decode((String) binary);
        } catch (IOException e) {
          //todo gérer exception
        }
      }
    }
  }
  return result;
}

代码示例来源:origin: sirensolutions/siren-join

protected Map<String, Object> parseQuery(String source) {
 try {
  byte[] bytes = Base64.decode(source);
  return this.parseQuery(new BytesArray(bytes, 0, bytes.length));
 }
 catch (IOException e) {
  throw new ElasticsearchParseException("Failed to parse source [" + source + "]", e);
 }
}

代码示例来源:origin: jboss-fuse/fabric8

return new String(Base64.decode(authInfo));
} catch (IOException e) {
  logger.debug("Http Basic credentials: [{}] impossible to base 64 decode.", authInfo);

代码示例来源:origin: io.fabric8.insight/insight-elasticsearch-auth-plugin

return new String(Base64.decode(authInfo));
} catch (IOException e) {
  logger.debug("Http Basic credentials: [{}] impossible to base 64 decode.", authInfo);

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

static ParsedScrollId parseScrollId(String scrollId) {
  CharsRefBuilder spare = new CharsRefBuilder();
  try {
    byte[] decode = Base64.decode(scrollId, Base64.URL_SAFE);
    spare.copyUTF8Bytes(decode, 0, decode.length);
  } catch (Exception e) {

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

} else {
  try {
    bytes = new BytesArray(Base64.decode(value.toString()));
  } catch (IOException e) {
    throw new ElasticsearchParseException("failed to convert bytes", e);

相关文章