code: public void write(long record, byte[] bytes) throws IOException {
          if (readonly) {
              throw new UnsupportedOperationException(RO_MSG);
          }
          if (bytes.length != recordSize) {
              final String fmt = "invalid write of %d bytes, expected %d";
              final String msg = format(fmt, bytes.length, recordSize);
              throw new InvalidArgument(msg);
          }
          // (+ recordSize) allows skipping metadata record
          long pos = record * recordSize + recordSize;
          if (pos >= size) {
              final String fmt = "bad seek to position: %d (size is %d)";
              final String msg = format(fmt, pos, size);
              throw new InvalidArgument(msg);
          }
          raf.seek(pos);
          raf.write(bytes);
      }
docs: Writes a record to this record file, overwriting the previous contents.
  
  @param record The record being written
  @param bytes The bytes to write
  @throws IOException Thrown if an I/O error occurs during I/O seeks or
  writes
  @throws UnsupportedOperationException Thrown if the mode is set to
  read-only
  @throws InvalidArgument Thrown if a write of anything other than the size
  of the record is requested