org.apache.hadoop.io.UTF8.write()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(145)

本文整理了Java中org.apache.hadoop.io.UTF8.write()方法的一些代码示例,展示了UTF8.write()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。UTF8.write()方法的具体详情如下:
包路径:org.apache.hadoop.io.UTF8
类名称:UTF8
方法名:write

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"));
}

相关文章