algairim commented on a change in pull request #1301:
URL: https://github.com/apache/brooklyn-server/pull/1301#discussion_r810002645
##########
File path:
utils/common/src/main/java/org/apache/brooklyn/util/stream/StreamGobbler.java
##########
@@ -60,50 +63,84 @@ public void shutdown() {
String logPrefix = "";
String printPrefix = "";
+
public StreamGobbler setPrefix(String prefix) {
setLogPrefix(prefix);
setPrintPrefix(prefix);
return this;
}
+
public StreamGobbler setPrintPrefix(String prefix) {
printPrefix = prefix;
return this;
}
+
public StreamGobbler setLogPrefix(String prefix) {
logPrefix = prefix;
return this;
- }
-
+ }
+
@Override
public void run() {
- int c = -1;
+ int c, bytes = 0;
+ char[] utfSymbol = new char[2];
try {
- while (running.get() && (c=stream.read())>=0) {
- onChar(c);
+ ByteBuffer bb = ByteBuffer.allocate(4);
+ while (running.get() && (c = stream.read()) >= 0) {
+
+ if (bytes == 0) {
+ // Identify utf symbol size by Unicode page.
+ if (c >= 0xF0) {
+ bytes = 4;
+ } else if (c >= 0xE0) {
+ bytes = 3;
+ } else if (c >= 0xC2) {
+ bytes = 2;
+ } else {
+ bytes = 1;
+ }
+ }
+
+ //System.out.println(" [" + bb.position() + "] " +
Integer.toHexString(c)); // for DEBUG
Review comment:
This code is not needed anymore, removed in
ba780b1acac6c42b4d4f5cc8aa0d063339869847.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]