Class SaContentStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class SaContentStream
    extends java.io.InputStream
    InputStream extension to stream the document content.
    Wrapper for the InputStream to extend the stream with filename extension for the backend.
    Delegates most of the overwritten InputStream methods to the underlying stream, injected by the constructor.
    Author:
    mal
    • Constructor Summary

      Constructors 
      Constructor Description
      SaContentStream​(java.io.InputStream in, java.lang.String newFileName)
      Contructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()  
      void close()  
      boolean equals​(java.lang.Object obj)
      java.lang.String getFileName()  
      int hashCode()
      void mark​(int readlimit)
      boolean markSupported()
      int read()  
      int read​(byte[] b)
      int read​(byte[] b, int off, int len)
      void reset()  
      long skip​(long n)
      • Methods inherited from class java.io.InputStream

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

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SaContentStream

        public SaContentStream​(java.io.InputStream in,
                               java.lang.String newFileName)
        Contructor.
        Parameters:
        in - Input stream
        newFileName - Content file name. Note that the path will be cut off if contained when the document is stored in the archive.
    • Method Detail

      • read

        public int read()
                 throws java.io.IOException
        Specified by:
        read in class java.io.InputStream
        Returns:
        Next byte from stream
        Throws:
        java.io.IOException - IO exception
        See Also:
        InputStream.read()
      • close

        public void close()
                   throws java.io.IOException
        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 - IO exception
        See Also:
        InputStream.close()
      • reset

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

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

        public int available()
                      throws java.io.IOException
        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()
      • mark

        public void mark​(int readlimit)
        Overrides:
        mark in class java.io.InputStream
        See Also:
        InputStream.mark(int)
      • markSupported

        public boolean markSupported()
        Overrides:
        markSupported in class java.io.InputStream
        See Also:
        InputStream.markSupported()
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
        See Also:
        InputStream.read(byte[], int, int)
      • read

        public int read​(byte[] b)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
        See Also:
        InputStream.read(byte[])
      • skip

        public long skip​(long n)
                  throws java.io.IOException
        Overrides:
        skip in class java.io.InputStream
        Throws:
        java.io.IOException
        See Also:
        InputStream.skip(long)
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
        See Also:
        Object.hashCode()