1 /*
2 * RDFpro - An extensible tool for building stream-oriented RDF processing libraries.
3 *
4 * Written in 2014 by Francesco Corcoglioniti with support by Marco Amadori, Michele Mostarda,
5 * Alessio Palmero Aprosio and Marco Rospocher. Contact info on http://rdfpro.fbk.eu/
6 *
7 * To the extent possible under law, the authors have dedicated all copyright and related and
8 * neighboring rights to this software to the public domain worldwide. This software is
9 * distributed without any warranty.
10 *
11 * You should have received a copy of the CC0 Public Domain Dedication along with this software.
12 * If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
13 */
14 package eu.fbk.rdfpro.tql;
15
16 import java.io.OutputStream;
17 import java.io.OutputStreamWriter;
18 import java.io.Writer;
19 import java.nio.charset.Charset;
20
21 import org.openrdf.rio.RDFFormat;
22 import org.openrdf.rio.RDFWriter;
23 import org.openrdf.rio.RDFWriterFactory;
24
25 /**
26 * An {@link RDFWriterFactory} for TQL writers.
27 */
28 public class TQLWriterFactory implements RDFWriterFactory {
29
30 /**
31 * Returns {@link TQL#FORMAT}.
32 */
33 @Override
34 public RDFFormat getRDFFormat() {
35 return TQL.FORMAT;
36 }
37
38 /**
39 * Returns a new instance of {@link TQLWriter}.
40 */
41 @Override
42 public RDFWriter getWriter(final OutputStream out) {
43 return getWriter(new OutputStreamWriter(out, Charset.forName("UTF-8")));
44 }
45
46 /**
47 * Returns a new instance of {@link TQLWriter}.
48 */
49 @Override
50 public RDFWriter getWriter(final Writer writer) {
51 return new TQLWriter(writer);
52 }
53
54 }