io.netty.handler.codec.base64.Base64.decode()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(179)

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

Base64.decode介绍

暂无

代码示例

代码示例来源:origin: netty/netty

public static ByteBuf decode(
    ByteBuf src, int off, int len) {
  return decode(src, off, len, Base64Dialect.STANDARD);
}

代码示例来源:origin: netty/netty

public static ByteBuf decode(ByteBuf src) {
  return decode(src, Base64Dialect.STANDARD);
}

代码示例来源:origin: redisson/redisson

public static ByteBuf decode(
    ByteBuf src, int off, int len) {
  return decode(src, off, len, Base64Dialect.STANDARD);
}

代码示例来源:origin: redisson/redisson

public static ByteBuf decode(ByteBuf src) {
  return decode(src, Base64Dialect.STANDARD);
}

代码示例来源:origin: wildfly/wildfly

public static ByteBuf decode(
    ByteBuf src, int off, int len) {
  return decode(src, off, len, Base64Dialect.STANDARD);
}

代码示例来源:origin: netty/netty

@Override
  protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
    out.add(Base64.decode(msg, msg.readerIndex(), msg.readableBytes(), dialect));
  }
}

代码示例来源:origin: wildfly/wildfly

public static ByteBuf decode(ByteBuf src) {
  return decode(src, Base64Dialect.STANDARD);
}

代码示例来源:origin: netty/netty

public static ByteBuf decode(ByteBuf src, Base64Dialect dialect) {
  if (src == null) {
    throw new NullPointerException("src");
  }
  ByteBuf dest = decode(src, src.readerIndex(), src.readableBytes(), dialect);
  src.readerIndex(src.writerIndex());
  return dest;
}

代码示例来源:origin: redisson/redisson

@Override
  protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
    out.add(Base64.decode(msg, msg.readerIndex(), msg.readableBytes(), dialect));
  }
}

代码示例来源:origin: redisson/redisson

public static ByteBuf decode(ByteBuf src, Base64Dialect dialect) {
  if (src == null) {
    throw new NullPointerException("src");
  }
  ByteBuf dest = decode(src, src.readerIndex(), src.readableBytes(), dialect);
  src.readerIndex(src.writerIndex());
  return dest;
}

代码示例来源:origin: netty/netty

public static ByteBuf decode(
    ByteBuf src, int off, int len, Base64Dialect dialect) {
  return decode(src, off, len, dialect, src.alloc());
}

代码示例来源:origin: wildfly/wildfly

@Override
  protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
    out.add(Base64.decode(msg, msg.readerIndex(), msg.readableBytes(), dialect));
  }
}

代码示例来源:origin: redisson/redisson

public static ByteBuf decode(
    ByteBuf src, int off, int len, Base64Dialect dialect) {
  return decode(src, off, len, dialect, src.alloc());
}

代码示例来源:origin: wildfly/wildfly

public static ByteBuf decode(ByteBuf src, Base64Dialect dialect) {
  if (src == null) {
    throw new NullPointerException("src");
  }
  ByteBuf dest = decode(src, src.readerIndex(), src.readableBytes(), dialect);
  src.readerIndex(src.writerIndex());
  return dest;
}

代码示例来源:origin: relayrides/pushy

protected static byte[] decodeBase64EncodedString(final String base64EncodedString) {
    final ByteBuf base64EncodedByteBuf =
        Unpooled.wrappedBuffer(base64EncodedString.getBytes(StandardCharsets.US_ASCII));

    final ByteBuf decodedByteBuf = Base64.decode(base64EncodedByteBuf);
    final byte[] decodedBytes = new byte[decodedByteBuf.readableBytes()];

    decodedByteBuf.readBytes(decodedBytes);

    base64EncodedByteBuf.release();
    decodedByteBuf.release();

    return decodedBytes;
  }
}

代码示例来源:origin: wildfly/wildfly

public static ByteBuf decode(
    ByteBuf src, int off, int len, Base64Dialect dialect) {
  return decode(src, off, len, dialect, src.alloc());
}

代码示例来源:origin: redisson/redisson

static ByteBuf[] readCertificates(InputStream in) throws CertificateException {
  String content;
  try {
    content = readContent(in);
  } catch (IOException e) {
    throw new CertificateException("failed to read certificate input stream", e);
  }
  List<ByteBuf> certs = new ArrayList<ByteBuf>();
  Matcher m = CERT_PATTERN.matcher(content);
  int start = 0;
  for (;;) {
    if (!m.find(start)) {
      break;
    }
    ByteBuf base64 = Unpooled.copiedBuffer(m.group(1), CharsetUtil.US_ASCII);
    ByteBuf der = Base64.decode(base64);
    base64.release();
    certs.add(der);
    start = m.end();
  }
  if (certs.isEmpty()) {
    throw new CertificateException("found no certificates in input stream");
  }
  return certs.toArray(new ByteBuf[0]);
}

代码示例来源:origin: redisson/redisson

static ByteBuf readPrivateKey(InputStream in) throws KeyException {
  String content;
  try {
    content = readContent(in);
  } catch (IOException e) {
    throw new KeyException("failed to read key input stream", e);
  }
  Matcher m = KEY_PATTERN.matcher(content);
  if (!m.find()) {
    throw new KeyException("could not find a PKCS #8 private key in input stream" +
        " (see http://netty.io/wiki/sslcontextbuilder-and-private-key.html for more information)");
  }
  ByteBuf base64 = Unpooled.copiedBuffer(m.group(1), CharsetUtil.US_ASCII);
  ByteBuf der = Base64.decode(base64);
  base64.release();
  return der;
}

代码示例来源:origin: wildfly/wildfly

static ByteBuf readPrivateKey(InputStream in) throws KeyException {
  String content;
  try {
    content = readContent(in);
  } catch (IOException e) {
    throw new KeyException("failed to read key input stream", e);
  }
  Matcher m = KEY_PATTERN.matcher(content);
  if (!m.find()) {
    throw new KeyException("could not find a PKCS #8 private key in input stream" +
        " (see http://netty.io/wiki/sslcontextbuilder-and-private-key.html for more information)");
  }
  ByteBuf base64 = Unpooled.copiedBuffer(m.group(1), CharsetUtil.US_ASCII);
  ByteBuf der = Base64.decode(base64);
  base64.release();
  return der;
}

代码示例来源:origin: wildfly/wildfly

/**
 * Decodes the settings header and returns a {@link Http2Settings} object.
 */
private Http2Settings decodeSettingsHeader(ChannelHandlerContext ctx, CharSequence settingsHeader)
    throws Http2Exception {
  ByteBuf header = ByteBufUtil.encodeString(ctx.alloc(), CharBuffer.wrap(settingsHeader), CharsetUtil.UTF_8);
  try {
    // Decode the SETTINGS payload.
    ByteBuf payload = Base64.decode(header, URL_SAFE);
    // Create an HTTP/2 frame for the settings.
    ByteBuf frame = createSettingsFrame(ctx, payload);
    // Decode the SETTINGS frame and return the settings object.
    return decodeSettings(ctx, frame);
  } finally {
    header.release();
  }
}

相关文章