使用hive创建一个默认分割符的表,然后打开其hdfs上的数据文件。\001用键盘是无法打出来的,在notepad中显示为SOF。把这个SOF复制到idea中,发现是\u0001。
import org.junit.jupiter.api.Test;
import java.io.*;
public class hive分割符 {
@Test
public void t1() throws IOException {
String str = "C:\\Users\\Administrator\\Desktop\\000000_0";
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(str)));
String str1 = br.readLine();
System.out.println(str1.replace("\u0001","|"));
System.out.println(str1.split("\u0001").length);
}
}