code: public byte[] read() throws IOException {
      Closer closer = Closer.create();
      try {
        InputStream in = closer.register(openStream());
        Optional<Long> size = sizeIfKnown();
        return size.isPresent()
            ? ByteStreams.toByteArray(in, size.get())
            : ByteStreams.toByteArray(in);
      } catch (Throwable e) {
        throw closer.rethrow(e);
      } finally {
        closer.close();
      }
    }
docs: 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