MCPcopy
hub / github.com/google/guava / read

Method read

guava/src/com/google/common/io/ByteSource.java:292–305  ·  view source on GitHub ↗

Reads the full contents of this byte source as a byte array. @throws IOException if an I/O error occurs while reading from this source

()

Source from the content-addressed store, hash-verified

290 * @throws IOException if an I/O error occurs while reading from this source
291 */
292 public byte[] read() throws IOException {
293 Closer closer = Closer.create();
294 try {
295 InputStream in = closer.register(openStream());
296 Optional<Long> size = sizeIfKnown();
297 return size.isPresent()
298 ? ByteStreams.toByteArray(in, size.get())
299 : ByteStreams.toByteArray(in);
300 } catch (Throwable e) {
301 throw closer.rethrow(e);
302 } finally {
303 closer.close();
304 }
305 }
306
307 /**
308 * Reads the contents of this byte source using the given {@code processor} to process bytes as

Callers 15

testThresholdMethod · 0.95
testResetMethod · 0.95
assertCorrectSliceMethod · 0.95
copyMethod · 0.45
copyReaderToBuilderMethod · 0.45
copyReaderToWriterMethod · 0.45
exhaustMethod · 0.45
readUnsignedByteMethod · 0.45
readAndCheckByteMethod · 0.45

Calls 11

createMethod · 0.95
registerMethod · 0.95
openStreamMethod · 0.95
sizeIfKnownMethod · 0.95
toByteArrayMethod · 0.95
rethrowMethod · 0.95
closeMethod · 0.95
readBytesMethod · 0.95
getMethod · 0.65
isPresentMethod · 0.45
checkNotNullMethod · 0.45

Tested by 6

testThresholdMethod · 0.76
testResetMethod · 0.76
assertCorrectSliceMethod · 0.76