Package org.semanticweb.owlapi.io
Class DocumentSources
java.lang.Object
org.semanticweb.owlapi.io.DocumentSources
Static methods from AbstractOWLParser. Mostly used by OWLOntologyDocumentSource implementations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<InputStream>
getInputStream
(IRI documentIRI, OWLOntologyLoaderConfiguration config) Deprecated.static Optional<InputStream>
getInputStream
(IRI documentIRI, OWLOntologyLoaderConfiguration config, String acceptHeaders) A convenience method that obtains an input stream from a URI.static InputStream
wrap
(InputStream delegate) Wrap an input stream to strip the BOM.static InputStream
wrapInput
(OWLOntologyDocumentSource source, OWLOntologyLoaderConfiguration configuration) Select the available input source as an input stream.static Reader
wrapInputAsReader
(OWLOntologyDocumentSource source, OWLOntologyLoaderConfiguration configuration) Call #wrapwrapInputAsReader(OWLOntologyLoaderConfiguration, String) with UTF-* as default encoding.static Reader
wrapInputAsReader
(OWLOntologyDocumentSource source, OWLOntologyLoaderConfiguration configuration, Charset encoding) Select the available input source and, if it is not already a Reader, wrap it in a Reader.
-
Method Details
-
wrapInputAsReader
public static Reader wrapInputAsReader(OWLOntologyDocumentSource source, OWLOntologyLoaderConfiguration configuration, Charset encoding) throws OWLOntologyInputSourceException Select the available input source and, if it is not already a Reader, wrap it in a Reader. This method removes the duplication of code required for each caller to figure out if a reader or an inputstream is available. The returned Reader will be buffered.- Parameters:
source
- ontology sourceconfiguration
- loader configuration to use of the reader must be built form the input IRIencoding
- character encoding if a new Reader needs to be created.- Returns:
- A Reader for the input; if no Reader can be obtained, an OWLOntologyInputSourceException is thrown.
- Throws:
OWLOntologyInputSourceException
- if an IO related exception is thrown.
-
wrapInputAsReader
public static Reader wrapInputAsReader(OWLOntologyDocumentSource source, OWLOntologyLoaderConfiguration configuration) throws OWLOntologyInputSourceException Call #wrapwrapInputAsReader(OWLOntologyLoaderConfiguration, String) with UTF-* as default encoding.- Parameters:
source
- ontology sourceconfiguration
- loader configuration to use of the reader must be built form the input IRI- Returns:
- A Reader wrapped in an Optional; if no Reader can be obtained, the result is Optional.empty. @throws OWLOntologyInputSourceException if an IO related exception is thrown.
- Throws:
OWLOntologyInputSourceException
- if an IO related exception is thrown.
-
wrapInput
public static InputStream wrapInput(OWLOntologyDocumentSource source, OWLOntologyLoaderConfiguration configuration) throws OWLOntologyInputSourceException Select the available input source as an input stream. The input stream will be buffered.- Parameters:
source
- ontology sourceconfiguration
- loader configuration to use of the reader must be built form the input IRI- Returns:
- A Reader for the input; if no Reader can be obtained, an OWLOntologyInputSourceException is thrown.
- Throws:
OWLOntologyInputSourceException
- if an IO related exception is thrown.
-
getInputStream
@Deprecated public static Optional<InputStream> getInputStream(IRI documentIRI, OWLOntologyLoaderConfiguration config) throws OWLOntologyInputSourceException Deprecated.A convenience method that obtains an input stream from a URI. This method sets up the correct request type and wraps the input stream within a buffered input stream.- Parameters:
documentIRI
- The URI from which the input stream should be returnedconfig
- the load configuration- Returns:
- The input stream obtained from the URI
- Throws:
OWLOntologyInputSourceException
- if there was anIOException
in obtaining the input stream from the URI.
-
getInputStream
public static Optional<InputStream> getInputStream(IRI documentIRI, OWLOntologyLoaderConfiguration config, String acceptHeaders) throws OWLOntologyInputSourceException A convenience method that obtains an input stream from a URI. This method sets up the correct request type and wraps the input stream within a buffered input stream.- Parameters:
documentIRI
- The URI from which the input stream should be returnedconfig
- the load configurationacceptHeaders
- accept headers for the connection- Returns:
- The input stream obtained from the URI
- Throws:
OWLOntologyInputSourceException
- if there was anIOException
in obtaining the input stream from the URI.
-
wrap
Wrap an input stream to strip the BOM.- Parameters:
delegate
- delegate to wrap- Returns:
- wrapped input stream
-
getInputStream(IRI, OWLOntologyLoaderConfiguration, String)
instead