本文整理了Java中org.apache.jena.atlas.lib.Bytes.string2bytes()
方法的一些代码示例,展示了Bytes.string2bytes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytes.string2bytes()
方法的具体详情如下:
包路径:org.apache.jena.atlas.lib.Bytes
类名称:Bytes
方法名:string2bytes
[英]Return the UTF-8 bytes for a string
[中]返回字符串的UTF-8字节
代码示例来源:origin: apache/jena
@Override
public Node call() {
return alloc(Bytes.string2bytes(label));
}
};
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
@Override
public Node alloc(String label) {
return alloc(Bytes.string2bytes(label)) ;
}
代码示例来源:origin: apache/jena
private static InputStream stream(String data)
{
byte[] b = Bytes.string2bytes(data) ;
return new ByteArrayInputStream(b) ;
}
代码示例来源:origin: apache/jena
private static void hash(Hash h, String lex, String lang, String datatype, String nodeName) {
if ( datatype == null )
datatype = "";
if ( lang == null )
lang = "";
String toHash = lex + "|" + lang + "|" + datatype + "|" + nodeName;
MessageDigest digest;
try {
// MessageDigest.getInstance("MD5");
digest = allocDigest();
digest.update(Bytes.string2bytes(toHash));
if ( h.getLen() == 16 ) {
// MD5 is 16 bytes.
digest.digest(h.getBytes(), 0, 16);
} else {
byte b[] = digest.digest(); // 16 bytes.
System.arraycopy(b, 0, h.getBytes(), 0, h.getLen());
}
deallocDigest(digest);
return;
}
catch (DigestException ex) {
Log.error(NodeLib.class, "DigestException", ex);
}
}
代码示例来源:origin: apache/jena
private static void hash(Hash h, String lex, String lang, String datatype, NodeType nodeType) {
if ( datatype == null )
datatype = "";
if ( lang == null )
lang = "";
String toHash = lex + "|" + lang + "|" + datatype + "|" + nodeType.getName();
MessageDigest digest;
try {
digest = allocDigest();
digest.update(Bytes.string2bytes(toHash));
if ( h.getLen() == 16 )
// MD5 is 16 bytes.
digest.digest(h.getBytes(), 0, 16);
else {
byte b[] = digest.digest(); // 16 bytes.
// Avoid the copy if length is 16?
// digest.digest(bytes, 0, length) needs 16 bytes
System.arraycopy(b, 0, h.getBytes(), 0, h.getLen());
}
deallocDigest(digest);
return;
}
catch (DigestException ex) {
Log.error(NodeLib.class, "DigestException", ex);
}
}
内容来源于网络,如有侵权,请联系作者删除!