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

x33g5p2x  于2022-01-29 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(92)

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

Text.validateUTF8介绍

[英]Check if a byte array contains valid utf-8
[中]检查字节数组是否包含有效的utf-8

代码示例

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

/** 
 * Check if a byte array contains valid utf-8
 * @param utf8 byte array
 * @throws MalformedInputException if the byte array contains invalid utf-8
 */
public static void validateUTF8(byte[] utf8) throws MalformedInputException {
 validateUTF8(utf8, 0, utf8.length);     
}

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

/** 
 * Check if a byte array contains valid utf-8
 * @param utf8 byte array
 * @throws MalformedInputException if the byte array contains invalid utf-8
 */
public static void validateUTF8(byte[] utf8) throws MalformedInputException {
 validateUTF8(utf8, 0, utf8.length);     
}

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

/** 
 * Check if a byte array contains valid utf-8
 * @param utf8 byte array
 * @throws MalformedInputException if the byte array contains invalid utf-8
 */
public static void validateUTF8(byte[] utf8) throws MalformedInputException {
 validateUTF8(utf8, 0, utf8.length);     
}

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

/** 
 * Check if a byte array contains valid utf-8
 * @param utf8 byte array
 * @throws MalformedInputException if the byte array contains invalid utf-8
 */
public static void validateUTF8(byte[] utf8) throws MalformedInputException {
 validateUTF8(utf8, 0, utf8.length);     
}

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

/** 
 * Check if a byte array contains valid utf-8
 * @param utf8 byte array
 * @throws MalformedInputException if the byte array contains invalid utf-8
 */
public static void validateUTF8(byte[] utf8) throws MalformedInputException {
 validateUTF8(utf8, 0, utf8.length);     
}

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

/** 
 * Check if a byte array contains valid utf-8
 * @param utf8 byte array
 * @throws MalformedInputException if the byte array contains invalid utf-8
 */
public static void validateUTF8(byte[] utf8) throws MalformedInputException {
 validateUTF8(utf8, 0, utf8.length);     
}

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

/** 
 * Check if a byte array contains valid utf-8
 * @param utf8 byte array
 * @throws MalformedInputException if the byte array contains invalid utf-8
 */
public static void validateUTF8(byte[] utf8) throws MalformedInputException {
 validateUTF8(utf8, 0, utf8.length);     
}

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

public void testValidate() throws Exception {
 Text text = new Text("abcd\u20acbdcd\u20ac");
 byte [] utf8 = text.getBytes();
 int length = text.getLength();
 Text.validateUTF8(utf8, 0, length);
}

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

public void testNonUTF8() throws Exception{
 // this is a non UTF8 byte array
 byte b[] = {-0x01, -0x01, -0x01, -0x01, -0x01, -0x01, -0x01};
 boolean nonUTF8 = false;
 Text t = new Text(b);
 try{
  Text.validateUTF8(b);
 }catch(MalformedInputException me){
  nonUTF8 = false;
 }
 // asserting that the byte array is non utf8
 assertFalse(nonUTF8);
 byte ret[] = t.getBytes();
 // asseting that the byte array are the same when the Text
 // object is created.
 assertTrue(Arrays.equals(b, ret));
}

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

public void testValidate() throws Exception {
 Text text = new Text("abcd\u20acbdcd\u20ac");
 byte [] utf8 = text.getBytes();
 int length = text.getLength();
 Text.validateUTF8(utf8, 0, length);
}

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

public void testValidate() throws Exception {
 Text text = new Text("abcd\u20acbdcd\u20ac");
 byte [] utf8 = text.getBytes();
 int length = text.getLength();
 Text.validateUTF8(utf8, 0, length);
}

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

public void testNonUTF8() throws Exception{
 // this is a non UTF8 byte array
 byte b[] = {-0x01, -0x01, -0x01, -0x01, -0x01, -0x01, -0x01};
 boolean nonUTF8 = false;
 Text t = new Text(b);
 try{
  Text.validateUTF8(b);
 }catch(MalformedInputException me){
  nonUTF8 = false;
 }
 // asserting that the byte array is non utf8
 assertFalse(nonUTF8);
 byte ret[] = t.getBytes();
 // asseting that the byte array are the same when the Text
 // object is created.
 assertTrue(Arrays.equals(b, ret));
}

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

public void testNonUTF8() throws Exception{
 // this is a non UTF8 byte array
 byte b[] = {-0x01, -0x01, -0x01, -0x01, -0x01, -0x01, -0x01};
 boolean nonUTF8 = false;
 Text t = new Text(b);
 try{
  Text.validateUTF8(b);
 }catch(MalformedInputException me){
  nonUTF8 = false;
 }
 // asserting that the byte array is non utf8
 assertFalse(nonUTF8);
 byte ret[] = t.getBytes();
 // asseting that the byte array are the same when the Text
 // object is created.
 assertTrue(Arrays.equals(b, ret));
}

相关文章