Class UpdateSensitiveLOBLocatorInputStream

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

    abstract class UpdateSensitiveLOBLocatorInputStream
    extends java.io.InputStream
    Super-class of the Update sensitive locator streams. Before a read operation if performed on the stream this stream verifies that the underlying LOB has not changed and if it has it recreates the specific streams. Since Locator streams are specific to Blob and Clob the sub-classes would take care of creating the appropriate streams.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      private void identifyAndReplaceObseleteStream()
      Verifies whether the current updateCount matches the updateCount of the LOB object and if it does not it recreates the stream.
      int read()  
      int read​(byte[] b, int off, int len)  
      protected abstract java.io.InputStream reCreateStream()
      Abstract method that will be implemented by the underlying streams specific to Clob and Blob.
      • Methods inherited from class java.io.InputStream

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

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

      • is

        private java.io.BufferedInputStream is
      • lob

        private Lob lob
      • updateCount

        private long updateCount
      • currentPos

        protected long currentPos
      • length

        protected long length
    • Constructor Detail

      • UpdateSensitiveLOBLocatorInputStream

        protected UpdateSensitiveLOBLocatorInputStream​(ClientConnection con,
                                                       Lob lob,
                                                       java.io.InputStream is)
                                                throws SqlException
        Initializes the InputStream, updateCount, currentPos and the connection to the appropriate values.
        Parameters:
        con - connection to be used to read the Lob value from the server
        lob - Lob object which could be a Blob or a Clob.
        is - an InputStream that contains the appropriate locator stream instance.
        Throws:
        SqlException
      • UpdateSensitiveLOBLocatorInputStream

        protected UpdateSensitiveLOBLocatorInputStream​(ClientConnection con,
                                                       Lob lob,
                                                       java.io.InputStream is,
                                                       long pos,
                                                       long len)
                                                throws SqlException
        Initializes the InputStream, updateCount, currentPos, length and the connection to the appropriate values.
        Parameters:
        con - connection to be used to read the Lob value from the server
        lob - Lob object which could be a Blob or a Clob.
        is - an InputStream that contains the appropriate locator stream instance.
        pos - the position from which the first read begins.
        len - the length in bytes of the partial value to be retrieved.
        Throws:
        SqlException
    • Method Detail

      • read

        public int read()
                 throws java.io.IOException
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
        See Also:
        InputStream.read()
      • 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)
      • 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
      • identifyAndReplaceObseleteStream

        private void identifyAndReplaceObseleteStream()
                                               throws java.io.IOException
        Verifies whether the current updateCount matches the updateCount of the LOB object and if it does not it recreates the stream.
        Throws:
        java.io.IOException - If any exception occurs upon Locator stream creation.
      • reCreateStream

        protected abstract java.io.InputStream reCreateStream()
                                                       throws SqlException
        Abstract method that will be implemented by the underlying streams specific to Clob and Blob.
        Throws:
        SqlException