code: public long size() throws IOException {
      Closer closer = Closer.create();
      try {
        InputStream in = closer.register(openStream());
        return countBySkipping(in);
      } catch (IOException e) {
        // skip may not be supported... at any rate, try reading
      } finally {
        closer.close();
      }
  
      closer = Closer.create();
      try {
        InputStream in = closer.register(openStream());
        return countByReading(in);
      } catch (Throwable e) {
        throw closer.rethrow(e);
      } finally {
        closer.close();
      }
    }
docs: Returns the size of this source in bytes. For most implementations, this is a heavyweight
  operation that will open a stream, read (or {@link InputStream#skip(long) skip}, if possible)
  to the end of the stream and return the total number of bytes that were read.
  
  <p>For some sources, such as a file, this method may use a more efficient implementation. Note
  that in such cases, it is <i>possible</i> that this method will return a different number of
  bytes than would be returned by reading all of the bytes (for example, some special files may
  return a size of 0 despite actually having content when read).
  
  <p>In either case, if this is a mutable source such as a file, the size it returns may not be
  the same number of bytes a subsequent read would return.
  
  @throws IOException if an I/O error occurs in the process of reading the size of this source