MCPcopy Index your code
hub / github.com/antlr/codebuff / isEmpty

Method isEmpty

output/java_guava/1.4.17/CharSource.java:348–362  ·  view source on GitHub ↗

Returns whether the source has zero chars. The default implementation returns true if #lengthIfKnown returns zero, falling back to opening a stream and checking for EOF if the length is not known. Note that, in cases where lengthIfKnown returns zero, it is possible that ch

()

Source from the content-addressed store, hash-verified

346
347
348 public boolean isEmpty() throws IOException {
349 Optional<Long> lengthIfKnown = lengthIfKnown();
350 if (lengthIfKnown.isPresent() && lengthIfKnown.get() == 0L) {
351 return true;
352 }
353 Closer closer = Closer.create();
354 try {
355 Reader reader = closer.register(openStream());
356 return reader.read() == -1;
357 } catch (Throwable e) {
358 throw closer.rethrow(e);
359 } finally {
360 closer.close();
361 }
362 }
363
364 /**
365 * Concatenates multiple {@link CharSource} instances into a single source. Streams returned from

Callers

nothing calls this directly

Calls 9

lengthIfKnownMethod · 0.95
createMethod · 0.95
registerMethod · 0.95
openStreamMethod · 0.95
rethrowMethod · 0.95
closeMethod · 0.95
getMethod · 0.65
isPresentMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected