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

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

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

UTF8.getBytes介绍

[英]The raw bytes.
[中]原始字节。

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-common

/** Construct a hash value for a String. */
public static MD5Hash digest(String string) {
 return digest(UTF8.getBytes(string));
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

/** Construct a hash value for a String. */
public static MD5Hash digest(UTF8 utf8) {
 return digest(utf8.getBytes(), 0, utf8.getLength());
}

代码示例来源:origin: elastic/elasticsearch-hadoop

generator.writeUTF8String(utf8.getBytes(), 0, utf8.getLength());

代码示例来源:origin: io.hops/hadoop-common

/** Construct a hash value for a String. */
public static MD5Hash digest(String string) {
 return digest(UTF8.getBytes(string));
}

代码示例来源:origin: com.facebook.hadoop/hadoop-core

/** Construct a hash value for a String. */
public static MD5Hash digest(String string) {
 return digest(UTF8.getBytes(string));
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/** Construct a hash value for a String. */
public static MD5Hash digest(String string) {
 return digest(UTF8.getBytes(string));
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

/** Construct a hash value for a String. */
public static MD5Hash digest(String string) {
 return digest(UTF8.getBytes(string));
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

/** Construct a hash value for a String. */
public static MD5Hash digest(String string) {
 return digest(UTF8.getBytes(string));
}

代码示例来源:origin: org.jvnet.hudson.hadoop/hadoop-core

/** Construct a hash value for a String. */
public static MD5Hash digest(String string) {
 return digest(UTF8.getBytes(string));
}

代码示例来源:origin: com.facebook.hadoop/hadoop-core

@SuppressWarnings("deprecation")
public static byte[] readBytes(DataInputStream in) throws IOException {
 UTF8 ustr = TL_DATA.get().U_STR;
 ustr.readFields(in);
 int len = ustr.getLength();
 byte[] bytes = new byte[len];
 System.arraycopy(ustr.getBytes(), 0, bytes, 0, len);
 return bytes;
}

代码示例来源:origin: org.jvnet.hudson.hadoop/hadoop-core

static byte[] readBytes(DataInputStream in) throws IOException {
 U_STR.readFields(in);
 int len = U_STR.getLength();
 byte[] bytes = new byte[len];
 System.arraycopy(U_STR.getBytes(), 0, bytes, 0, len);
 return bytes;
}

代码示例来源:origin: org.apache.hadoop/hadoop-common-test

public void testGetBytes() throws Exception {
 for (int i = 0; i < 10000; i++) {
  // generate a random string
  String before = getTestString();
  // check its utf8
  assertEquals(before, new String(UTF8.getBytes(before), "UTF-8"));
 }
}

代码示例来源:origin: io.hops/hadoop-common

/** Construct a hash value for a String. */
public static MD5Hash digest(UTF8 utf8) {
 return digest(utf8.getBytes(), 0, utf8.getLength());
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

/** Construct a hash value for a String. */
public static MD5Hash digest(UTF8 utf8) {
 return digest(utf8.getBytes(), 0, utf8.getLength());
}

代码示例来源:origin: com.facebook.hadoop/hadoop-core

/** Construct a hash value for a String. */
public static MD5Hash digest(UTF8 utf8) {
 return digest(utf8.getBytes(), 0, utf8.getLength());
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

/** Construct a hash value for a String. */
public static MD5Hash digest(UTF8 utf8) {
 return digest(utf8.getBytes(), 0, utf8.getLength());
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/** Construct a hash value for a String. */
public static MD5Hash digest(UTF8 utf8) {
 return digest(utf8.getBytes(), 0, utf8.getLength());
}

代码示例来源:origin: org.jvnet.hudson.hadoop/hadoop-core

/** Construct a hash value for a String. */
public static MD5Hash digest(UTF8 utf8) {
 return digest(utf8.getBytes(), 0, utf8.getLength());
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

public void testGetBytes() throws Exception {
 for (int i = 0; i < 10000; i++) {
  // generate a random string
  String before = getTestString();
  // Check that the bytes are stored correctly in Modified-UTF8 format.
  // Note that the DataInput and DataOutput interfaces convert between
  // bytes and Strings using the Modified-UTF8 format.
  assertEquals(before, readModifiedUTF(UTF8.getBytes(before)));
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

public void testGetBytes() throws Exception {
 for (int i = 0; i < 10000; i++) {
  // generate a random string
  String before = getTestString();
  // Check that the bytes are stored correctly in Modified-UTF8 format.
  // Note that the DataInput and DataOutput interfaces convert between
  // bytes and Strings using the Modified-UTF8 format.
  assertEquals(before, readModifiedUTF(UTF8.getBytes(before)));
 }
}

相关文章