code: public static Relay read(File file) throws IOException {
      RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw");
      FileOperator fileOperator = new FileOperator(randomAccessFile.getChannel());
  
      // Read the header.
      Buffer header = new Buffer();
      fileOperator.read(0, header, FILE_HEADER_SIZE);
      ByteString prefix = header.readByteString(PREFIX_CLEAN.size());
      if (!prefix.equals(PREFIX_CLEAN)) throw new IOException("unreadable cache file");
      long upstreamSize = header.readLong();
      long metadataSize = header.readLong();
  
      // Read the metadata.
      Buffer metadataBuffer = new Buffer();
      fileOperator.read(FILE_HEADER_SIZE + upstreamSize, metadataBuffer, metadataSize);
      ByteString metadata = metadataBuffer.readByteString();
  
      // Return the result.
      return new Relay(randomAccessFile, null, upstreamSize, metadata, 0L);
    }
docs: Creates a relay that reads a recorded stream from {@code file}.
  
  <p><strong>Warning:</strong> callers to this method must immediately call {@link #newSource} to
  create a source and close that when they're done. Otherwise a handle to {@code file} will be
  leaked.