# Class Gff3Writer

java.lang.Object
htsjdk.tribble.gff.Gff3Writer

All Implemented Interfaces:
  `Closeable, AutoCloseable`

public class Gff3Writer extends Object implements Closeable
A class to write out gff3 files. Features are added using `addFeature(Gff3Feature)`, directives using `addDirective(Gff3Codec.Gff3Directive)`, and comments using `addComment(String)`. Note that the version 3 directive is automatically added at creation, so should not be added separately.

## Constructor Summary

Constructors
Constructor
Description
`Gff3Writer(OutputStream stream)`
`Gff3Writer(Path path)`

## Method Summary

Modifier and Type
Method
Description
`void`
`addComment(String comment)`
Add comment line
`void`
`addDirective(Gff3Codec.Gff3Directive directive)`
Add a directive
`void`
`addDirective(Gff3Codec.Gff3Directive directive, Object object)`
Add a directive with an object
`void`
`addFeature(Gff3Feature feature)`
add a feature
`void`
`close()`
`protected String`
`escapeString(String s)`
escape a String.

### Methods inherited from class Object

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

## Constructor Details

### Gff3Writer

public Gff3Writer(Path path) throws IOException

Throws:
  `IOException`

### Gff3Writer

public Gff3Writer(OutputStream stream)

## Method Details

### addFeature

public void addFeature(Gff3Feature feature) throws IOException
add a feature

Parameters:
  `feature` - the feature to be added
Throws:
  `IOException`

### escapeString

protected String escapeString(String s)
escape a String. Default behavior is to call `encodeString(String)`

Parameters:
  `s` - the string to be escaped
Returns:
  the escaped string

### addDirective

public void addDirective(Gff3Codec.Gff3Directive directive, Object object) throws IOException
Add a directive with an object

Parameters:
  `directive` - the directive to be added
  `object` - the object to be encoded with the directive
Throws:
  `IOException`

### addDirective

public void addDirective(Gff3Codec.Gff3Directive directive) throws IOException
Add a directive

Parameters:
  `directive` - the directive to be added
Throws:
  `IOException`

### addComment

public void addComment(String comment) throws IOException
Add comment line

Parameters:
  `comment` - the comment line (not including leading #)
Throws:
  `IOException`

### close

public void close() throws IOException

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