Class StreamDocumentSourceBase

java.lang.Object
org.semanticweb.owlapi.io.OWLOntologyDocumentSourceBase
org.semanticweb.owlapi.io.StreamDocumentSourceBase
All Implemented Interfaces:
OWLOntologyDocumentSource
Direct Known Subclasses:
ReaderDocumentSource, StreamDocumentSource

public abstract class StreamDocumentSourceBase extends OWLOntologyDocumentSourceBase
Base class for common utilities among stream, reader and file input sources.
Since:
4.0.0 TODO both stream and reader sources copy the input in memory in case reloading is needed. This can be bad for memory. Remote loading will download the ontologies multiple times too, until parsing fails. Both issues could be addressed with a local file copy.
  • Constructor Details

    • StreamDocumentSourceBase

      public StreamDocumentSourceBase(InputStream stream, IRI documentIRI, @Nullable OWLDocumentFormat format, @Nullable String mime)
      Constructs an input source which will read an ontology from a representation from the specified stream.
      Parameters:
      stream - The stream that the ontology representation will be read from.
      documentIRI - The document IRI
      format - ontology format
      mime - mime type
    • StreamDocumentSourceBase

      public StreamDocumentSourceBase(Reader stream, IRI documentIRI, @Nullable OWLDocumentFormat format, @Nullable String mime)
      Constructs an input source which will read an ontology from a representation from the specified stream.
      Parameters:
      stream - The stream that the ontology representation will be read from.
      documentIRI - The document IRI
      format - ontology format
      mime - mime type
  • Method Details

    • getInputStream

      public Optional<InputStream> getInputStream()
      Description copied from interface: OWLOntologyDocumentSource
      If an input stream can be obtained from this document source then this method creates it. This method may be called multiple times. Each invocation will return a new input stream. If there is no input stream available, returns Optional.absent. .
      Returns:
      A new input stream which the ontology can be read from, wrapped in an Optional.
    • getReader

      public Optional<Reader> getReader()
      Description copied from interface: OWLOntologyDocumentSource
      Gets a reader which an ontology document can be read from. This method may be called multiple times. Each invocation will return a new Reader. If there is no reader stream available, returns Optional.absent.
      Returns:
      A new Reader which the ontology can be read from, wrapped in an Optional.