Package htsjdk.samtools.util

# Class IntervalListWriter

java.lang.Object
htsjdk.samtools.util.IntervalListWriter

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

public class IntervalListWriter extends Object implements Closeable
Writes out the list of intervals to the supplied file. This class is particularly useful if we have many intervals to write, such that they all cannot be held in memory, for example in an `IntervalList`.

## Constructor Summary

Constructors
Constructor
Description
`IntervalListWriter(Path path)`
Creates a new writer, writing a header to the file.
`IntervalListWriter(Path path, SAMFileHeader header)`
Creates a new writer, writing a header to the file.

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
Closes the writer.
`void`
`write(Interval interval)`
Writes a single interval list.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### IntervalListWriter

public IntervalListWriter(Path path)
Creates a new writer, writing a header to the file.

Parameters:
  `path` - a path to write to. If exists it will be overwritten.

### IntervalListWriter

public IntervalListWriter(Path path, SAMFileHeader header)
Creates a new writer, writing a header to the file.

Parameters:
  `path` - a file to write to. If exists it will be overwritten.
  `header` - the header to write.

## Method Details

### write

public void write(Interval interval) throws IOException
Writes a single interval list.

Parameters:
  `interval` - the interval to write.
Throws:
  `IOException`

### close

public void close() throws IOException
Closes the writer.

Specified by:
  `close` in interface `AutoCloseable`
Specified by:
  `close` in interface `Closeable`
Throws:
  `IOException`