当前位置: 首页>>代码示例>>Java>>正文


Java ByteBufUtil.hexDump方法代码示例

本文整理汇总了Java中io.netty.buffer.ByteBufUtil.hexDump方法的典型用法代码示例。如果您正苦于以下问题:Java ByteBufUtil.hexDump方法的具体用法?Java ByteBufUtil.hexDump怎么用?Java ByteBufUtil.hexDump使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.netty.buffer.ByteBufUtil的用法示例。


在下文中一共展示了ByteBufUtil.hexDump方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: certificateRejected

import io.netty.buffer.ByteBufUtil; //导入方法依赖的package包/类
private void certificateRejected(X509Certificate certificate) {
    if (rejectedDir == null) {
        return;
    }

    try {
        String[] ss = certificate.getSubjectX500Principal().getName().split(",");
        String name = ss.length > 0 ? ss[0] : certificate.getSubjectX500Principal().getName();
        String thumbprint = ByteBufUtil.hexDump(Unpooled.wrappedBuffer(DigestUtil.sha1(certificate.getEncoded())));

        String filename = String.format("%s [%s].der", URLEncoder.encode(name, "UTF-8"), thumbprint);

        File f = new File(rejectedDir.getAbsolutePath() + File.separator + filename);

        try (FileOutputStream fos = new FileOutputStream(f)) {
            fos.write(certificate.getEncoded());
            fos.flush();
        }

        logger.debug("Added rejected certificate entry: {}", filename);
    } catch (CertificateEncodingException | IOException e) {
        logger.error("Error adding rejected certificate entry.", e);
    }
}
 
开发者ID:eclipse,项目名称:milo,代码行数:25,代码来源:DefaultCertificateValidator.java

示例2: FingerprintTrustManagerFactory

import io.netty.buffer.ByteBufUtil; //导入方法依赖的package包/类
/**
 * Creates a new instance.
 *
 * @param fingerprints a list of SHA1 fingerprints
 */
public FingerprintTrustManagerFactory(byte[]... fingerprints) {
    if (fingerprints == null) {
        throw new NullPointerException("fingerprints");
    }

    List<byte[]> list = new ArrayList<byte[]>();
    for (byte[] f: fingerprints) {
        if (f == null) {
            break;
        }
        if (f.length != SHA1_BYTE_LEN) {
            throw new IllegalArgumentException("malformed fingerprint: " +
                    ByteBufUtil.hexDump(Unpooled.wrappedBuffer(f)) + " (expected: SHA1)");
        }
        list.add(f.clone());
    }

    this.fingerprints = list.toArray(new byte[list.size()][]);
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:25,代码来源:FingerprintTrustManagerFactory.java

示例3: channelRead

import io.netty.buffer.ByteBufUtil; //导入方法依赖的package包/类
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
    if (msg instanceof Http2Settings) {
        // Expected
    } else {
        try {
            final String typeInfo;
            if (msg instanceof ByteBuf) {
                typeInfo = msg + " HexDump: " + ByteBufUtil.hexDump((ByteBuf) msg);
            } else {
                typeInfo = String.valueOf(msg);
            }
            throw new IllegalStateException("unexpected message type: " + typeInfo);
        } finally {
            ReferenceCountUtil.release(msg);
        }
    }
}
 
开发者ID:line,项目名称:armeria,代码行数:19,代码来源:HttpSessionHandler.java

示例4: certificateRejected

import io.netty.buffer.ByteBufUtil; //导入方法依赖的package包/类
private void certificateRejected(X509Certificate certificate) {
    try {
        String[] ss = certificate.getSubjectX500Principal().getName().split(",");
        String name = ss.length > 0 ? ss[0] : certificate.getSubjectX500Principal().getName();
        String thumbprint = ByteBufUtil.hexDump(Unpooled.wrappedBuffer(DigestUtil.sha1(certificate.getEncoded())));

        String filename = String.format("%s [%s].der", URLEncoder.encode(name, "UTF-8"), thumbprint);

        File f = new File(rejectedDir.getAbsolutePath() + File.separator + filename);

        FileOutputStream fos = new FileOutputStream(f);
        fos.write(certificate.getEncoded());
        fos.flush();
        fos.close();

        logger.debug("Added rejected certificate entry: {}", filename);
    } catch (CertificateEncodingException | IOException e) {
        logger.error("Error adding rejected certificate entry.", e);
    }
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:21,代码来源:DefaultCertificateValidator.java

示例5: bytesToHex

import io.netty.buffer.ByteBufUtil; //导入方法依赖的package包/类
private static String bytesToHex(ByteBuf bytes) {
    try {
        return ByteBufUtil.hexDump(bytes);
    } finally {
        bytes.release();
    }
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:8,代码来源:DefaultNamingScheme.java

示例6: asShortText

import io.netty.buffer.ByteBufUtil; //导入方法依赖的package包/类
@Override
public String asShortText() {
    String shortValue = this.shortValue;
    if (shortValue == null) {
        this.shortValue = shortValue = ByteBufUtil.hexDump(
                data, MACHINE_ID_LEN + PROCESS_ID_LEN + SEQUENCE_LEN + TIMESTAMP_LEN, RANDOM_LEN);
    }
    return shortValue;
}
 
开发者ID:amaralDaniel,项目名称:megaphone,代码行数:10,代码来源:DefaultChannelId.java

示例7: getFilename

import io.netty.buffer.ByteBufUtil; //导入方法依赖的package包/类
private static String getFilename(X509Certificate certificate) throws Exception {
    String[] ss = certificate.getSubjectX500Principal().getName().split(",");
    String name = ss.length > 0 ? ss[0] : certificate.getSubjectX500Principal().getName();
    String thumbprint = ByteBufUtil.hexDump(Unpooled.wrappedBuffer(DigestUtil.sha1(certificate.getEncoded())));

    return String.format("%s [%s].der", thumbprint, URLEncoder.encode(name, "UTF-8"));
}
 
开发者ID:eclipse,项目名称:milo,代码行数:8,代码来源:DirectoryCertificateValidator.java

示例8: channelRead

import io.netty.buffer.ByteBufUtil; //导入方法依赖的package包/类
@Override
public void channelRead(final ChannelHandlerContext ctx, final Object msg) throws Exception {
    final ByteBuf byteBuf = (ByteBuf) msg;
    final String hexDump = ByteBufUtil.hexDump(byteBuf);
    final ByteBuf response = copiedBuffer(hexDump, CharsetUtil.UTF_8);

    ctx.writeAndFlush(response);
}
 
开发者ID:kgusarov,项目名称:spring-boot-netty,代码行数:9,代码来源:Server2Handler.java

示例9: toString

import io.netty.buffer.ByteBufUtil; //导入方法依赖的package包/类
@Override
public String toString() {
    if (refCnt() == 0) {
        return "SctpFrame{" +
                "streamIdentifier=" + streamIdentifier + ", protocolIdentifier=" + protocolIdentifier +
                ", data=(FREED)}";
    }
    return "SctpFrame{" +
            "streamIdentifier=" + streamIdentifier + ", protocolIdentifier=" + protocolIdentifier +
            ", data=" + ByteBufUtil.hexDump(content()) + '}';
}
 
开发者ID:wuyinxian124,项目名称:netty4.0.27Learn,代码行数:12,代码来源:SctpMessage.java

示例10: buildOpaqueValue

import io.netty.buffer.ByteBufUtil; //导入方法依赖的package包/类
private static HexString buildOpaqueValue(final ByteBuf buffer) {
    final int length = buffer.readUnsignedShort();
    final byte[] value = ByteArray.readBytes(buffer, length);
    final String hexDump = ByteBufUtil.hexDump(value);
    final Iterable<String> splitted = Splitter.fixedLength(2).split(hexDump);
    return new HexString(Joiner.on(SEPARATOR).join(splitted));
}
 
开发者ID:opendaylight,项目名称:bgpcep,代码行数:8,代码来源:OpaqueUtil.java

示例11: generateRequestId

import io.netty.buffer.ByteBufUtil; //导入方法依赖的package包/类
protected String generateRequestId() {
    byte[] id = new byte[16];
    // TODO JDK UPGRADE replace to native ThreadLocalRandom
    ThreadLocalRandom.current().nextBytes(id);
    return ByteBufUtil.hexDump(id);
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:7,代码来源:BaseRemoteService.java

示例12: generateId

import io.netty.buffer.ByteBufUtil; //导入方法依赖的package包/类
protected String generateId() {
    byte[] id = new byte[16];
    // TODO JDK UPGRADE replace to native ThreadLocalRandom
    ThreadLocalRandom.current().nextBytes(id);
    return ByteBufUtil.hexDump(id);
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:7,代码来源:RedissonPermitExpirableSemaphore.java

示例13: generateId

import io.netty.buffer.ByteBufUtil; //导入方法依赖的package包/类
private String generateId() {
    byte[] id = new byte[8];
    // TODO JDK UPGRADE replace to native ThreadLocalRandom
    ThreadLocalRandom.current().nextBytes(id);
    return ByteBufUtil.hexDump(id);
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:7,代码来源:RedissonNode.java

示例14: toString

import io.netty.buffer.ByteBufUtil; //导入方法依赖的package包/类
@Override
public String toString() {
    return "UNKNOWN - " + Integer.toHexString(id) + " - Hex: " + ByteBufUtil.hexDump(buf);
}
 
开发者ID:voxelwind,项目名称:voxelwind,代码行数:5,代码来源:McpeUnknown.java

示例15: toString

import io.netty.buffer.ByteBufUtil; //导入方法依赖的package包/类
@Override
public String toString() {
    return super.toString() + ByteBufUtil.hexDump(data);
}
 
开发者ID:diohpix,项目名称:flazr-fork,代码行数:5,代码来源:DataMessage.java


注:本文中的io.netty.buffer.ByteBufUtil.hexDump方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。