去除Byte数组的空字符\u0000

 byte[] outputByte = new byte[4096];
                    String str = new String(outputByte);
					Pattern pattern = Pattern.compile("([^\u0000]*)");
					Matcher matcher = pattern.matcher(str);
					if(matcher.find(0)){
						System.out.println(matcher.group(1).getBytes("utf-8"));
					}

猜你喜欢

转载自blog.csdn.net/linfanhehe/article/details/89488890