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

 

展开阅读全文

没有更多推荐了,返回首页