public static void render(final AbstractMessageLite message) { throw new RenderBinary( new ByteArrayInputStream(message.toByteArray()), null, 0, "application/x-google-protobuf", true); }
public void testCheckByteStringIsUtf8OnNonUtf8() { ByteString byteString = ByteString.copyFrom(new byte[] {(byte) 0x80}); // A lone continuation byte. try { AbstractMessageLite.checkByteStringIsUtf8(byteString); fail("Expected AbstractMessageLite.checkByteStringIsUtf8 to throw IllegalArgumentException"); } catch (IllegalArgumentException exception) { assertEquals("Byte string is not UTF-8.", exception.getMessage()); } }
public void testCheckByteStringIsUtf8OnUtf8() { ByteString byteString = ByteString.copyFromUtf8("some text"); AbstractMessageLite.checkByteStringIsUtf8(byteString); // No exception thrown. }