java "\u001B[J" 代表什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13801273/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does "\u001B[J" represent?
提问by Baz
Can anyone explain to me what \u001B[J within a string might represent? I'm converting an input byte stream to an ascii string. Perhaps the stream is in some other encoding.
谁能向我解释一下字符串中的 \u001B[J 可能代表什么?我正在将输入字节流转换为 ascii 字符串。也许流采用其他编码。
UPDATE:
更新:
This is how I read the stream
这就是我阅读流的方式
inputStreamReader = new InputStreamReader(session.getStdout(), "ASCII");
int length = inputStreamReader.read(buffer);
stringBuilder.append(buffer, 0, length);
// LOG the result
StringEscapeUtils.escapeJava(stringBuilder.toString());
回答by paxdiablo
回答by Baz
\u001B[J
means unicode
表示 Unicode
Unicode is stored in 2 bytes, so after \u there is 4x hexa bytes, in this case is \u001B
The [J
is from other
Unicode是存储在2个字节,所以后\ u是4倍六字节存在,在这种情况下是\u001B
在[J
从其他