本文整理了Java中org.apache.hadoop.io.UTF8.write()
方法的一些代码示例,展示了UTF8.write()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UTF8.write()
方法的具体详情如下:
包路径:org.apache.hadoop.io.UTF8
类名称:UTF8
方法名:write
[英]Write a UTF-8 encoded string.
[中]写一个UTF-8编码的字符串。
代码示例来源:origin: com.facebook.hadoop/hadoop-core
@SuppressWarnings("deprecation")
static void writeString(String str, DataOutputStream out) throws IOException {
UTF8 ustr = TL_DATA.get().U_STR;
ustr.set(str, true);
ustr.write(out);
}
代码示例来源:origin: org.jvnet.hudson.hadoop/hadoop-core
static void writeString(String str, DataOutputStream out) throws IOException {
U_STR.set(str);
U_STR.write(out);
}
}
代码示例来源:origin: com.facebook.hadoop/hadoop-core
/** write the long value */
static void writeLongAsString(long value, DataOutputStream out) throws IOException {
UTF8 ustr = TL_DATA.get().U_STR;
ustr.set(toLogLong(value), true);
ustr.write(out);
}
代码示例来源:origin: com.facebook.hadoop/hadoop-core
/** write the long value */
static void writeShortAsString(short value, DataOutputStream out) throws IOException {
UTF8 ustr = TL_DATA.get().U_STR;
ustr.set(toLogShort(value), true);
ustr.write(out);
}
代码示例来源:origin: org.apache.hadoop/hadoop-common-test
public void testNullEncoding() throws Exception {
String s = new String(new char[] { 0 });
DataOutputBuffer dob = new DataOutputBuffer();
new UTF8(s).write(dob);
assertEquals(s, new String(dob.getData(), 2, dob.getLength()-2, "UTF-8"));
}
代码示例来源:origin: ch.cern.hadoop/hadoop-common
public void testNullEncoding() throws Exception {
String s = new String(new char[] { 0 });
DataOutputBuffer dob = new DataOutputBuffer();
new UTF8(s).write(dob);
assertEquals(s, new String(dob.getData(), 2, dob.getLength()-2, "UTF-8"));
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-common
public void testNullEncoding() throws Exception {
String s = new String(new char[] { 0 });
DataOutputBuffer dob = new DataOutputBuffer();
new UTF8(s).write(dob);
assertEquals(s, new String(dob.getData(), 2, dob.getLength()-2, "UTF-8"));
}
内容来源于网络,如有侵权,请联系作者删除!