Class SaRMIInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable
    Direct Known Subclasses:
    SaRMIInputStreamSeekable

    public class SaRMIInputStream
    extends java.io.InputStream
    A InputStream that reads data of a document identified by it's HDOC from the archive.
    • Constructor Summary

      Constructors 
      Constructor Description
      SaRMIInputStream​(java.lang.String hdoc, boolean currentRevision, int elementNumber, boolean withAnnotations, SaRMIClientCommand connector, java.lang.Object monitor)
      Constructs the SaRMIInputStream instance which represents the input stream of the document (will be returned from the Saperion backend).
      SaRMIInputStream​(java.lang.String hdoc, boolean currentRevision, int elementNumber, SaRMIClientCommand connector, boolean dummy, java.lang.Object monitor)
      Constructs the SaRMIInputStream instance which represents the input stream of the document (will be returned from the Saperion backend).
      SaRMIInputStream​(java.lang.String hdoc, boolean currentRevision, int elementNumber, SaRMIClientCommand connector, java.lang.Object monitor)
      Constructs the SaRMIInputStream instance which represents the input stream of the document (will be returned from the Saperion backend).
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      int available()
      Deprecated. 
      void close()
      closes the input stream of the current document.
      int getDocElement()
      Retrieves the document index.
      java.lang.String getDocHdoc()
      Retrieves the hdoc.
      java.lang.String getFileName()  
      boolean isCurrentRevision()
      True, if the current revision should be fetched.
      boolean isDummy()
      If true, no content will be read from the backend.
      boolean isWithAnnotations()
      True, if annotations should be saved on the document.
      boolean markSupported()
      Tests if this input stream supports the mark and reset methods.
      int read()
      Reads the next byte of the document from the archive.
      protected com.saperion.jni.SaJNIReadBuffer readDocumentFirst​(java.lang.String docHdoc, boolean curRevision, int docElement, boolean withAnnotations)  
      void reset()  
      void setFileName​(java.lang.String newFileName)  
      • Methods inherited from class java.io.InputStream

        mark, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, skip, transferTo
      • Methods inherited from class java.lang.Object

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

      • docHdoc

        protected final java.lang.String docHdoc
      • docElement

        protected final int docElement
      • byteBuffer

        protected byte[] byteBuffer
      • bufferSize

        protected int bufferSize
      • started

        protected boolean started
      • closed

        protected boolean closed
      • bufferPointer

        protected int bufferPointer
      • handle

        protected com.saperion.jni.SaJNIDocHandle handle
      • curRevision

        protected boolean curRevision
    • Constructor Detail

      • SaRMIInputStream

        public SaRMIInputStream​(java.lang.String hdoc,
                                boolean currentRevision,
                                int elementNumber,
                                SaRMIClientCommand connector,
                                java.lang.Object monitor)
        Constructs the SaRMIInputStream instance which represents the input stream of the document (will be returned from the Saperion backend).
        Parameters:
        hdoc - Document HDOC
        currentRevision - flag indicating that the current revision of the document should be retrieved by resolving hdoc
        elementNumber - number of the structure-element to read from
        connector - the rmi-client connector used to read data from the archive
        monitor - a ClassicConnector instance used to synchronize calls on the connector
      • SaRMIInputStream

        public SaRMIInputStream​(java.lang.String hdoc,
                                boolean currentRevision,
                                int elementNumber,
                                boolean withAnnotations,
                                SaRMIClientCommand connector,
                                java.lang.Object monitor)
        Constructs the SaRMIInputStream instance which represents the input stream of the document (will be returned from the Saperion backend).
        Parameters:
        hdoc - Document HDOC
        currentRevision - flag indicating that the current revision of the document should be retrieved by resolving hdoc
        elementNumber - number of the structure-element to read from
        withAnnotations - if true, annotations will be saved on the document stream
        connector - the rmi-client connector used to read data from the archive
        monitor - a ClassicConnector instance used to synchronize calls on the connector
      • SaRMIInputStream

        public SaRMIInputStream​(java.lang.String hdoc,
                                boolean currentRevision,
                                int elementNumber,
                                SaRMIClientCommand connector,
                                boolean dummy,
                                java.lang.Object monitor)
        Constructs the SaRMIInputStream instance which represents the input stream of the document (will be returned from the Saperion backend).
        Parameters:
        hdoc - Document HDOC
        currentRevision - flag indicating that the current revision of the document should be retrieved by resolving hdoc
        elementNumber - number of the structure-element to read from
        connector - the rmi-client connector used to read data from the archive
        dummy - if true, no content will be read from the backend. Instead the
        monitor - a ClassicConnector instance used to synchronize calls on the connector
    • Method Detail

      • read

        public int read()
                 throws java.io.IOException
        Reads the next byte of the document from the archive.
        Specified by:
        read in class java.io.InputStream
        Returns:
        Next byte from stream
        Throws:
        java.io.IOException - Exception
        See Also:
        InputStream.read()
      • close

        public void close()
                   throws java.io.IOException
        closes the input stream of the current document.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.InputStream
        Throws:
        java.io.IOException - Exception
        See Also:
        InputStream.close()
      • reset

        public void reset()
                   throws java.io.IOException
        Overrides:
        reset in class java.io.InputStream
        Throws:
        java.io.IOException - IOException
        See Also:
        InputStream.reset()
      • markSupported

        public boolean markSupported()
        Tests if this input stream supports the mark and reset methods. Whether or not mark and reset are supported is an invariant property of a particular input stream instance. The markSupported method of InputStream returns false.
        Overrides:
        markSupported in class java.io.InputStream
        Returns:
        true if this stream instance supports the mark and reset methods; false otherwise.
        See Also:
        InputStream.mark(int), InputStream.reset()
      • getFileName

        public java.lang.String getFileName()
        Returns:
        file name
      • setFileName

        public void setFileName​(java.lang.String newFileName)
        Parameters:
        newFileName - File name to set
      • available

        @Deprecated
        public int available()
                      throws java.io.IOException
        Deprecated.
        Overrides:
        available in class java.io.InputStream
        Returns:
        the number of bytes that can be read from this input stream without blocking.
        Throws:
        java.io.IOException - IO exception
        See Also:
        InputStream.available()
      • getDocHdoc

        public java.lang.String getDocHdoc()
        Retrieves the hdoc.
        Returns:
        target document hdoc
      • getDocElement

        public int getDocElement()
        Retrieves the document index.
        Returns:
        document index
      • isCurrentRevision

        public boolean isCurrentRevision()
        True, if the current revision should be fetched.
        Returns:
        isCurrentRevision
      • isDummy

        public boolean isDummy()
        If true, no content will be read from the backend. Instead the read method will always return -1.
        Returns:
        isDummy
      • isWithAnnotations

        public boolean isWithAnnotations()
        True, if annotations should be saved on the document.
        Returns:
        true, if the withAnnotations flag is set to true