Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39568a24 authored by Neil Fuller's avatar Neil Fuller
Browse files

Remove usage of StringFactory

Code outside of the runtime should not use StringFactory.
The java.lang.String API works fine.

Bug: 113148576
Test: build only
Change-Id: I67ce6d7a13afd3ca7c0beffb33289d93e906e4be
parent b49d8ec1
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -737,8 +737,7 @@ public final class ProtoInputStream extends ProtoStream {
        fillBuffer();
        if (mOffset + n <= mEnd) {
            // fast path read. String is well within the current buffer
            String value = StringFactory.newStringFromBytes(mBuffer, mOffset, n,
                    StandardCharsets.UTF_8);
            String value = new String(mBuffer, mOffset, n, StandardCharsets.UTF_8);
            incOffset(n);
            return value;
        } else if (n <= mBufferSize) {
@@ -752,14 +751,13 @@ public final class ProtoInputStream extends ProtoStream {
            mDiscardedBytes += mOffset;
            mOffset = 0;

            String value = StringFactory.newStringFromBytes(mBuffer, mOffset, n,
                    StandardCharsets.UTF_8);
            String value = new String(mBuffer, mOffset, n, StandardCharsets.UTF_8);
            incOffset(n);
            return value;
        }
        // Otherwise, the string is too large to use the buffer. Create the string from a
        // separate byte array.
        return StringFactory.newStringFromBytes(readRawBytes(n), 0, n, StandardCharsets.UTF_8);
        return new String(readRawBytes(n), 0, n, StandardCharsets.UTF_8);
    }

    /**