Created
January 11, 2021 03:53
-
-
Save Malinskiy/ca79344a66990041f63a808bf0b28242 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private ByteArrayOutputStream mPendingData = new ByteArrayOutputStream(); | |
public void addOutput(byte[] data, int offset, int length) { | |
mPendingData.write(data, offset, length); | |
try { | |
InstrumentationData.Session session = | |
InstrumentationData.Session.parseFrom(mPendingData.toByteArray()); | |
mPendingData.reset(); | |
updateState(session); | |
} | |
catch (InvalidProtocolBufferException e) { | |
// InvalidProtocolBufferException may happen if a given new output data is incomplete. | |
// Let's just skip updating mSession and wait for incoming data. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment