Loading core/java/android/util/proto/ProtoInputStream.java +3 −5 Original line number Original line Diff line number Diff line Loading @@ -737,8 +737,7 @@ public final class ProtoInputStream extends ProtoStream { fillBuffer(); fillBuffer(); if (mOffset + n <= mEnd) { if (mOffset + n <= mEnd) { // fast path read. String is well within the current buffer // fast path read. String is well within the current buffer String value = StringFactory.newStringFromBytes(mBuffer, mOffset, n, String value = new String(mBuffer, mOffset, n, StandardCharsets.UTF_8); StandardCharsets.UTF_8); incOffset(n); incOffset(n); return value; return value; } else if (n <= mBufferSize) { } else if (n <= mBufferSize) { Loading @@ -752,14 +751,13 @@ public final class ProtoInputStream extends ProtoStream { mDiscardedBytes += mOffset; mDiscardedBytes += mOffset; mOffset = 0; mOffset = 0; String value = StringFactory.newStringFromBytes(mBuffer, mOffset, n, String value = new String(mBuffer, mOffset, n, StandardCharsets.UTF_8); StandardCharsets.UTF_8); incOffset(n); incOffset(n); return value; return value; } } // Otherwise, the string is too large to use the buffer. Create the string from a // Otherwise, the string is too large to use the buffer. Create the string from a // separate byte array. // separate byte array. return StringFactory.newStringFromBytes(readRawBytes(n), 0, n, StandardCharsets.UTF_8); return new String(readRawBytes(n), 0, n, StandardCharsets.UTF_8); } } /** /** Loading Loading
core/java/android/util/proto/ProtoInputStream.java +3 −5 Original line number Original line Diff line number Diff line Loading @@ -737,8 +737,7 @@ public final class ProtoInputStream extends ProtoStream { fillBuffer(); fillBuffer(); if (mOffset + n <= mEnd) { if (mOffset + n <= mEnd) { // fast path read. String is well within the current buffer // fast path read. String is well within the current buffer String value = StringFactory.newStringFromBytes(mBuffer, mOffset, n, String value = new String(mBuffer, mOffset, n, StandardCharsets.UTF_8); StandardCharsets.UTF_8); incOffset(n); incOffset(n); return value; return value; } else if (n <= mBufferSize) { } else if (n <= mBufferSize) { Loading @@ -752,14 +751,13 @@ public final class ProtoInputStream extends ProtoStream { mDiscardedBytes += mOffset; mDiscardedBytes += mOffset; mOffset = 0; mOffset = 0; String value = StringFactory.newStringFromBytes(mBuffer, mOffset, n, String value = new String(mBuffer, mOffset, n, StandardCharsets.UTF_8); StandardCharsets.UTF_8); incOffset(n); incOffset(n); return value; return value; } } // Otherwise, the string is too large to use the buffer. Create the string from a // Otherwise, the string is too large to use the buffer. Create the string from a // separate byte array. // separate byte array. return StringFactory.newStringFromBytes(readRawBytes(n), 0, n, StandardCharsets.UTF_8); return new String(readRawBytes(n), 0, n, StandardCharsets.UTF_8); } } /** /** Loading