@Override public RDFFormat convert(String value) { return RDFWriterRegistry.getInstance().getFileFormatForMIMEType(value).orElseThrow(Rio.unsupportedFormat(value)); }
private static String listRDFOut() { StringBuilder sb = new StringBuilder(); for (RDFFormat fmt : RDFWriterRegistry.getInstance().getKeys()) { sb.append("* ").append(fmt.getName()).append(" ("); boolean first = true; for (String ext : fmt.getFileExtensions()) { if (first) { first = false; } else { sb.append(", "); } sb.append('.').append(ext); } sb.append(")\n"); } return sb.toString(); }
/** * Tries to match the extension of a file name against the list of RDF formats that can be written. * * @param fileName * A file name. * @return An RDFFormat object if a match was found, or {@link Optional#empty()} otherwise. * @see #getWriterFormatForFileName(String, RDFFormat) */ public static Optional<RDFFormat> getWriterFormatForFileName(String fileName) { return RDFFormat.matchFileName(fileName, RDFWriterRegistry.getInstance().getKeys()); }
/** * Tries to match a MIME type against the list of RDF formats that can be written. * * @param mimeType * A MIME type, e.g. "application/rdf+xml". * @return An RDFFormat object if a match was found, or {@link Optional#empty()} otherwise. * @see #getWriterFormatForMIMEType(String, RDFFormat) */ public static Optional<RDFFormat> getWriterFormatForMIMEType(String mimeType) { return RDFFormat.matchMIMEType(mimeType, RDFWriterRegistry.getInstance().getKeys()); }
/** * Tries to match a MIME type against the list of RDF formats that can be written. * * @param mimeType * A MIME type, e.g. "application/rdf+xml". * @return An RDFFormat object if a match was found, or {@link Optional#empty()} otherwise. * @see #getWriterFormatForMIMEType(String, RDFFormat) */ public static Optional<RDFFormat> getWriterFormatForMIMEType(String mimeType) { return RDFFormat.matchMIMEType(mimeType, RDFWriterRegistry.getInstance().getKeys()); }
/** * Tries to match a MIME type against the list of RDF formats that can be written. * * @param mimeType * A MIME type, e.g. "application/rdf+xml". * @return An RDFFormat object if a match was found, or {@link Optional#empty()} otherwise. * @see #getWriterFormatForMIMEType(String, RDFFormat) */ public static Optional<RDFFormat> getWriterFormatForMIMEType(String mimeType) { return RDFFormat.matchMIMEType(mimeType, RDFWriterRegistry.getInstance().getKeys()); }
/** * Tries to match the extension of a file name against the list of RDF formats that can be written. * * @param fileName * A file name. * @return An RDFFormat object if a match was found, or {@link Optional#empty()} otherwise. * @see #getWriterFormatForFileName(String, RDFFormat) */ public static Optional<RDFFormat> getWriterFormatForFileName(String fileName) { return RDFFormat.matchFileName(fileName, RDFWriterRegistry.getInstance().getKeys()); }
/** * Tries to match the extension of a file name against the list of RDF formats that can be written. * * @param fileName * A file name. * @return An RDFFormat object if a match was found, or {@link Optional#empty()} otherwise. * @see #getWriterFormatForFileName(String, RDFFormat) */ public static Optional<RDFFormat> getWriterFormatForFileName(String fileName) { return RDFFormat.matchFileName(fileName, RDFWriterRegistry.getInstance().getKeys()); }
/** * Convenience methods for creating RDFWriter objects. This method uses the registry returned by * {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory * to create the appropriate writer. * * @throws UnsupportedRDFormatException * If no writer is available for the specified RDF format. */ public static RDFWriter createWriter(RDFFormat format, Writer writer) throws UnsupportedRDFormatException { RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow( Rio.unsupportedFormat(format)); return factory.getWriter(writer); }
/** * Convenience methods for creating RDFWriter objects. This method uses the registry returned by * {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory * to create the appropriate writer. * * @throws UnsupportedRDFormatException * If no writer is available for the specified RDF format. */ public static RDFWriter createWriter(RDFFormat format, OutputStream out) throws UnsupportedRDFormatException { RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow( Rio.unsupportedFormat(format)); return factory.getWriter(out); }
/** * Convenience methods for creating RDFWriter objects. This method uses the registry returned by * {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory * to create the appropriate writer. * * @throws UnsupportedRDFormatException * If no writer is available for the specified RDF format. */ public static RDFWriter createWriter(RDFFormat format, Writer writer) throws UnsupportedRDFormatException { RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow( Rio.unsupportedFormat(format)); return factory.getWriter(writer); }
/** * Convenience methods for creating RDFWriter objects. This method uses the registry returned by * {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory * to create the appropriate writer. * * @throws UnsupportedRDFormatException * If no writer is available for the specified RDF format. */ public static RDFWriter createWriter(RDFFormat format, OutputStream out) throws UnsupportedRDFormatException { RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow( Rio.unsupportedFormat(format)); return factory.getWriter(out); }
/** * Convenience methods for creating RDFWriter objects. This method uses the registry returned by * {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory * to create the appropriate writer. * * @throws UnsupportedRDFormatException * If no writer is available for the specified RDF format. */ public static RDFWriter createWriter(RDFFormat format, OutputStream out) throws UnsupportedRDFormatException { RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow( Rio.unsupportedFormat(format)); return factory.getWriter(out); }
/** * Convenience methods for creating RDFWriter objects. This method uses the registry returned by * {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory * to create the appropriate writer. * * @throws UnsupportedRDFormatException * If no writer is available for the specified RDF format. */ public static RDFWriter createWriter(RDFFormat format, Writer writer) throws UnsupportedRDFormatException { RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow( Rio.unsupportedFormat(format)); return factory.getWriter(writer); }
/** * Convenience methods for creating RDFWriter objects. This method uses the registry returned by * {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory * to create the appropriate writer. * * @throws UnsupportedRDFormatException * If no writer is available for the specified RDF format. * @throws URISyntaxException * If the baseURI is invalid */ public static RDFWriter createWriter(RDFFormat format, Writer writer, String baseURI) throws UnsupportedRDFormatException, URISyntaxException { RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow( Rio.unsupportedFormat(format)); return factory.getWriter(writer, baseURI); }
/** * Convenience methods for creating RDFWriter objects. This method uses the registry returned by * {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory * to create the appropriate writer. * * @throws UnsupportedRDFormatException * If no writer is available for the specified RDF format. * @throws URISyntaxException * If the baseURI is invalid */ public static RDFWriter createWriter(RDFFormat format, Writer writer, String baseURI) throws UnsupportedRDFormatException, URISyntaxException { RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow( Rio.unsupportedFormat(format)); return factory.getWriter(writer, baseURI); }
/** * Convenience methods for creating RDFWriter objects. This method uses the registry returned by * {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory * to create the appropriate writer. * * @throws UnsupportedRDFormatException * If no writer is available for the specified RDF format. * @throws URISyntaxException * If the baseURI is invalid */ public static RDFWriter createWriter(RDFFormat format, OutputStream out, String baseURI) throws UnsupportedRDFormatException, URISyntaxException { RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow( Rio.unsupportedFormat(format)); return factory.getWriter(out, baseURI); }
/** * Convenience methods for creating RDFWriter objects. This method uses the registry returned by * {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory * to create the appropriate writer. * * @throws UnsupportedRDFormatException * If no writer is available for the specified RDF format. * @throws URISyntaxException * If the baseURI is invalid */ public static RDFWriter createWriter(RDFFormat format, OutputStream out, String baseURI) throws UnsupportedRDFormatException, URISyntaxException { RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow( Rio.unsupportedFormat(format)); return factory.getWriter(out, baseURI); }
/** * Convenience methods for creating RDFWriter objects. This method uses the registry returned by * {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory * to create the appropriate writer. * * @throws UnsupportedRDFormatException * If no writer is available for the specified RDF format. * @throws URISyntaxException * If the baseURI is invalid */ public static RDFWriter createWriter(RDFFormat format, Writer writer, String baseURI) throws UnsupportedRDFormatException, URISyntaxException { RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow( Rio.unsupportedFormat(format)); return factory.getWriter(writer, baseURI); }
/** * Convenience methods for creating RDFWriter objects. This method uses the registry returned by * {@link RDFWriterRegistry#getInstance()} to get a factory for the specified format and uses this factory * to create the appropriate writer. * * @throws UnsupportedRDFormatException * If no writer is available for the specified RDF format. * @throws URISyntaxException * If the baseURI is invalid */ public static RDFWriter createWriter(RDFFormat format, OutputStream out, String baseURI) throws UnsupportedRDFormatException, URISyntaxException { RDFWriterFactory factory = RDFWriterRegistry.getInstance().get(format).orElseThrow( Rio.unsupportedFormat(format)); return factory.getWriter(out, baseURI); }