Class MCRSolrAbstractContentStream<T>

java.lang.Object
org.apache.solr.common.util.ContentStreamBase
org.mycore.solr.index.cs.MCRSolrAbstractContentStream<T>
All Implemented Interfaces:
AutoCloseable, org.apache.solr.common.util.ContentStream
Direct Known Subclasses:
MCRSolrPathContentStream

public abstract class MCRSolrAbstractContentStream<T> extends org.apache.solr.common.util.ContentStreamBase implements AutoCloseable
Wraps objects to be sent to solr in a content stream.
Author:
shermann, Matthias Eichner
See Also:
  • ContentStream
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.solr.common.util.ContentStreamBase

    org.apache.solr.common.util.ContentStreamBase.ByteArrayStream, org.apache.solr.common.util.ContentStreamBase.FileStream, org.apache.solr.common.util.ContentStreamBase.StringStream, org.apache.solr.common.util.ContentStreamBase.URLStream
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
     
    protected T
     
     

    Fields inherited from class org.apache.solr.common.util.ContentStreamBase

    contentType, DEFAULT_CHARSET, name, size, sourceInfo
  • Constructor Summary

    Constructors
    Constructor
    Description
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    protected Charset
    Required for getReader() to transform any InputStream into a Reader.
     
     
     
     
    boolean
    Checks if the content stream is already set up and ready to use.
    void
     
    protected abstract void
    Sets certain properties on a contentStream object.

    Methods inherited from class org.apache.solr.common.util.ContentStreamBase

    attemptToDetermineContentType, create, getCharsetFromContentType, getContentType, getName, getSourceInfo, setContentType, setName, setSize, setSourceInfo

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • setup

      protected boolean setup
    • streamReader

      protected InputStreamReader streamReader
    • source

      protected T source
  • Constructor Details

    • MCRSolrAbstractContentStream

      public MCRSolrAbstractContentStream()
    • MCRSolrAbstractContentStream

      public MCRSolrAbstractContentStream(T source)
  • Method Details

    • getStream

      public InputStream getStream() throws IOException
      Specified by:
      getStream in interface org.apache.solr.common.util.ContentStream
      Throws:
      IOException
    • setInputStream

      public void setInputStream(InputStream inputStream)
    • setup

      protected abstract void setup() throws IOException
      Sets certain properties on a contentStream object. Subclasses must override this method.

      Its important to call the following setter methods:

      • setName
      • setSize
      • setSourceInfo
      • setContentType
      • setInputStream
      Throws:
      IOException
    • getCharset

      protected Charset getCharset()
      Required for getReader() to transform any InputStream into a Reader.
      Returns:
      null, will default to "UTF-8"
    • isSetup

      public boolean isSetup()
      Checks if the content stream is already set up and ready to use.
      Returns:
      true if set up.
    • getReader

      public Reader getReader() throws IOException
      Specified by:
      getReader in interface org.apache.solr.common.util.ContentStream
      Overrides:
      getReader in class org.apache.solr.common.util.ContentStreamBase
      Throws:
      IOException
    • getSize

      public Long getSize()
      Specified by:
      getSize in interface org.apache.solr.common.util.ContentStream
      Overrides:
      getSize in class org.apache.solr.common.util.ContentStreamBase
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException
    • getSource

      public T getSource()