本文整理汇总了Java中sun.misc.HexDumpEncoder.encodeBuffer方法的典型用法代码示例。如果您正苦于以下问题:Java HexDumpEncoder.encodeBuffer方法的具体用法?Java HexDumpEncoder.encodeBuffer怎么用?Java HexDumpEncoder.encodeBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.misc.HexDumpEncoder
的用法示例。
在下文中一共展示了HexDumpEncoder.encodeBuffer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readFully
import sun.misc.HexDumpEncoder; //导入方法依赖的package包/类
private int readFully(InputStream s, byte b[], int off, int len)
throws IOException {
int n = 0;
while (n < len) {
int readLen = s.read(b, off + n, len - n);
if (readLen < 0) {
return readLen;
}
if (debug != null && Debug.isOn("packet")) {
try {
HexDumpEncoder hd = new HexDumpEncoder();
ByteBuffer bb = ByteBuffer.wrap(b, off + n, readLen);
System.out.println("[Raw read]: length = " +
bb.remaining());
hd.encodeBuffer(bb, System.out);
} catch (IOException e) { }
}
n += readLen;
exlen += readLen;
}
return n;
}
示例2: dumpPacket
import sun.misc.HexDumpEncoder; //导入方法依赖的package包/类
private void dumpPacket(EngineArgs ea, boolean hsData) {
try {
HexDumpEncoder hd = new HexDumpEncoder();
ByteBuffer bb = ea.netData.duplicate();
int pos = bb.position();
bb.position(pos - ea.deltaNet());
bb.limit(pos);
System.out.println("[Raw write" +
(hsData ? "" : " (bb)") + "]: length = " +
bb.remaining());
hd.encodeBuffer(bb, System.out);
} catch (IOException e) { }
}
示例3: toString
import sun.misc.HexDumpEncoder; //导入方法依赖的package包/类
public String toString() {
HexDumpEncoder hexDump = new HexDumpEncoder();
String out = "";
out += "Signer Info for (issuer): " + issuerName + "\n";
out += "\tversion: " + Debug.toHexString(version) + "\n";
out += "\tcertificateSerialNumber: " +
Debug.toHexString(certificateSerialNumber) + "\n";
out += "\tdigestAlgorithmId: " + digestAlgorithmId + "\n";
if (authenticatedAttributes != null) {
out += "\tauthenticatedAttributes: " + authenticatedAttributes +
"\n";
}
out += "\tdigestEncryptionAlgorithmId: " + digestEncryptionAlgorithmId +
"\n";
out += "\tencryptedDigest: " + "\n" +
hexDump.encodeBuffer(encryptedDigest) + "\n";
if (unauthenticatedAttributes != null) {
out += "\tunauthenticatedAttributes: " +
unauthenticatedAttributes + "\n";
}
return out;
}
示例4: writeBuffer
import sun.misc.HexDumpEncoder; //导入方法依赖的package包/类
void writeBuffer(OutputStream s, byte [] buf, int off, int len,
int debugOffset) throws IOException {
s.write(buf, off, len);
s.flush();
// Output only the record from the specified debug offset.
if (debug != null && Debug.isOn("packet")) {
try {
HexDumpEncoder hd = new HexDumpEncoder();
System.out.println("[Raw write]: length = " +
(len - debugOffset));
hd.encodeBuffer(new ByteArrayInputStream(buf,
off + debugOffset, len - debugOffset), System.out);
} catch (IOException e) { }
}
}
示例5: toString
import sun.misc.HexDumpEncoder; //导入方法依赖的package包/类
/**
* Return a printable string of IPaddress
*/
public String toString() {
try {
return "IPAddress: " + getName();
} catch (IOException ioe) {
// dump out hex rep for debugging purposes
HexDumpEncoder enc = new HexDumpEncoder();
return "IPAddress: " + enc.encodeBuffer(address);
}
}
示例6: toString
import sun.misc.HexDumpEncoder; //导入方法依赖的package包/类
/**
* Returns a printable representation of the KeyUsage.
*/
public String toString() {
String s = "KeyIdentifier [\n";
HexDumpEncoder encoder = new HexDumpEncoder();
s += encoder.encodeBuffer(octetString);
s += "]\n";
return (s);
}
示例7: toString
import sun.misc.HexDumpEncoder; //导入方法依赖的package包/类
public String toString()
{
HexDumpEncoder encoder = new HexDumpEncoder();
return "algorithm = " + algid.toString()
+ ", unparsed keybits = \n" + encoder.encodeBuffer(key);
}
示例8: hashInternal
import sun.misc.HexDumpEncoder; //导入方法依赖的package包/类
private void hashInternal(byte databuf [], int offset, int len) {
if (debug != null && Debug.isOn("data")) {
try {
HexDumpEncoder hd = new HexDumpEncoder();
System.out.println("[read] MD5 and SHA1 hashes: len = "
+ len);
hd.encodeBuffer(new ByteArrayInputStream(databuf, offset, len),
System.out);
} catch (IOException e) { }
}
handshakeHash.update(databuf, offset, len);
}
示例9: hashInternal
import sun.misc.HexDumpEncoder; //导入方法依赖的package包/类
private void hashInternal(byte buf [], int offset, int len) {
if (debug != null && Debug.isOn("data")) {
try {
HexDumpEncoder hd = new HexDumpEncoder();
System.out.println("[write] MD5 and SHA1 hashes: len = "
+ len);
hd.encodeBuffer(new ByteArrayInputStream(buf,
lastHashed, len), System.out);
} catch (IOException e) { }
}
handshakeHash.update(buf, lastHashed, len);
lastHashed = count;
}
示例10: toString
import sun.misc.HexDumpEncoder; //导入方法依赖的package包/类
public String toString() {
HexDumpEncoder hd = new HexDumpEncoder();
return "EncryptionKey: keyType=" + keyType
+ " keyBytes (hex dump)="
+ (keyBytes == null || keyBytes.length == 0 ?
" Empty Key" :
'\n' + hd.encodeBuffer(keyBytes)
+ '\n');
}
示例11: engineToString
import sun.misc.HexDumpEncoder; //导入方法依赖的package包/类
protected String engineToString() {
String LINE_SEP = System.getProperty("line.separator");
HexDumpEncoder encoder = new HexDumpEncoder();
StringBuilder sb
= new StringBuilder(LINE_SEP + " iv:" + LINE_SEP + "["
+ encoder.encodeBuffer(iv) + "]");
sb.append(LINE_SEP + "tLen(bits):" + LINE_SEP + tLen*8 + LINE_SEP);
return sb.toString();
}
示例12: toString
import sun.misc.HexDumpEncoder; //导入方法依赖的package包/类
public String toString() {
String LINE_SEP = System.getProperty("line.separator");
String ivString = LINE_SEP + " iv:" + LINE_SEP + "[";
HexDumpEncoder encoder = new HexDumpEncoder();
ivString += encoder.encodeBuffer(this.iv);
ivString += "]" + LINE_SEP;
return ivString;
}
示例13: engineToString
import sun.misc.HexDumpEncoder; //导入方法依赖的package包/类
protected String engineToString() {
String LINE_SEP = System.getProperty("line.separator");
String saltString = LINE_SEP + " salt:" + LINE_SEP + "[";
HexDumpEncoder encoder = new HexDumpEncoder();
saltString += encoder.encodeBuffer(salt);
saltString += "]";
return saltString + LINE_SEP + " iterationCount:"
+ LINE_SEP + Debug.toHexString(BigInteger.valueOf(iCount))
+ LINE_SEP;
}
示例14: engineToString
import sun.misc.HexDumpEncoder; //导入方法依赖的package包/类
protected String engineToString() {
String LINE_SEP = System.getProperty("line.separator");
HexDumpEncoder encoder = new HexDumpEncoder();
StringBuilder sb
= new StringBuilder(LINE_SEP + " iv:" + LINE_SEP + "["
+ encoder.encodeBuffer(iv) + "]");
if (version != 0) {
sb.append(LINE_SEP + "version:" + LINE_SEP
+ version + LINE_SEP);
}
return sb.toString();
}
示例15: printHex
import sun.misc.HexDumpEncoder; //导入方法依赖的package包/类
private static void printHex(HexDumpEncoder dump, byte[] bytes) {
if (bytes == null) {
System.out.println("(key bytes not available)");
} else {
try {
dump.encodeBuffer(bytes, System.out);
} catch (IOException e) {
// just for debugging, ignore this
}
}
}