code: public IndexOutput createOutput(String name) throws IOException {
      Path file = new Path(directory, name);
      if (fs.exists(file) && !fs.delete(file)) {
        // delete the existing one if applicable
        throw new IOException("Cannot overwrite index file " + file);
      }
  
      return new FileSystemIndexOutput(file, ioFileBufferSize);
    }
docs: /* (non-Javadoc)
  @see org.apache.lucene.store.Directory#createOutput(java.lang.String)