docs: private static long skipToEOF(final ImageInputStream stream) throws IOException {
          long length = stream.length();
  
          if (length > 0) {
              // Known length, skip there and we're done.
              stream.seek(length);
          }
          else {
              // Otherwise, seek to EOF the hard way.
              // First, store stream position...
              long pos = stream.getStreamPosition();
  
              // ...skip 1k blocks until we're passed EOF...
              while (stream.skipBytes(1024L) > 0) {
                  if (stream.read() == -1) {
                      break;
                  }
  
                  pos = stream.getStreamPosition();
              }
  
              // ...go back to last known pos...
              stream.seek(pos);
  
              // ...finally seek until EOF one byte at a time. Done.
              while (stream.read() != -1) {
              }
          }
  
          return stream.getStreamPosition();
      }