Package htsjdk.tribble.gff
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 usingaddFeature(Gff3Feature), directives usingaddDirective(Gff3Codec.Gff3Directive), and comments usingaddComment(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddComment(String comment)Add comment linevoidaddDirective(Gff3Codec.Gff3Directive directive)Add a directivevoidaddDirective(Gff3Codec.Gff3Directive directive, Object object)Add a directive with an objectvoidaddFeature(Gff3Feature feature)add a featurevoidclose()protected StringescapeString(String s)escape a String.
-
-
-
Constructor Detail
-
Gff3Writer
public Gff3Writer(Path path) throws IOException
- Throws:
IOException
-
Gff3Writer
public Gff3Writer(OutputStream stream)
-
-
Method Detail
-
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 callencodeString(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 addedobject- 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-