use of org.dartlang.vm.service.consumer.GetObjectConsumer in project flutter-intellij by flutter.
the class FlutterConsoleLogManager method getFullStringValue.
private String getFullStringValue(@NotNull VmService service, String isolateId, @Nullable InstanceRef ref) {
if (ref == null)
return null;
if (!ref.getValueAsStringIsTruncated()) {
return ref.getValueAsString();
}
final CountDownLatch latch = new CountDownLatch(1);
final String[] result = new String[1];
service.getObject(isolateId, ref.getId(), 0, ref.getLength(), new GetObjectConsumer() {
@Override
public void onError(RPCError error) {
result[0] = formatTruncatedString(ref);
latch.countDown();
}
@Override
public void received(Obj response) {
if (response instanceof Instance && ((Instance) response).getKind() == InstanceKind.String) {
result[0] = stringValueFromStringRef((Instance) response);
} else {
result[0] = formatTruncatedString(ref);
}
latch.countDown();
}
@Override
public void received(Sentinel response) {
result[0] = formatTruncatedString(ref);
latch.countDown();
}
});
try {
latch.await(1, TimeUnit.SECONDS);
} catch (InterruptedException e) {
return null;
}
return result[0];
}
Aggregations