當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。