Class VarlenaWrapper.Input.Stream

    • Constructor Detail

      • Stream

        public Stream()
    • Method Detail

      • pin

        protected void pin()
                    throws IOException
        Description copied from class: ByteBufferInputStream
        Pin resources if necessary during a reading operation.

        This default implementation does nothing. A subclass should override it if (in addition to synchronizing on m_lock), some pinning of a resource is needed during access operations.

        Overrides:
        pin in class ByteBufferInputStream
        Throws:
        IOException
      • toString

        public String toString​(Object o)
        Description copied from interface: VarlenaWrapper
        Return a string describing this object in a way useful for debugging, prefixed with the name (abbreviated for comfort) of the class of the object passed in (the normal Java toString() method should pass this).

        Subclasses or consumers are encouraged to call this method and append further details specific to the subclass or consumer. The convention should be that the recursion will stop at some class that will actually construct the abbreviated class name of o and use it to prefix the returned value.

        Specified by:
        toString in interface VarlenaWrapper
        Parameters:
        o - An object whose class name (possibly abbreviated) should be used to prefix the returned string.
        Returns:
        Description of this object.
      • verify

        public void verify​(VarlenaWrapper.Verifier v)
                    throws SQLException
        Apply a Verifier to the input data.

        This should only be necessary if the input wrapper is being used directly as an output item, and needs verification that it conforms to the format of the target type.

        The current position must be at the beginning of the stream. The verifier must leave it at the end to confirm the entire stream was examined. There should be no need to reset the position here, as the only anticipated use is during an adopt, and the native code will only care about the varlena's address.

        Throws:
        SQLException
      • buffer

        protected ByteBuffer buffer()
                             throws IOException
        Description copied from class: ByteBufferInputStream
        Return the ByteBuffer being wrapped, or throw an exception if the memory windowed by the buffer should no longer be accessed.

        The monitor on ByteBufferInputStream.m_lock is held when this method is called.

        This method also should throw an exception if ByteBufferInputStream.m_open is false. It is called everywhere that should happen, so it is the perfect place for the test, and allows the implementing class to use a customized message in the exception.

        All uses of the buffer in this class are preceded by pin() and followed by unpin() (whose default implementations in this class do nothing). If a subclass overrides pin with a version that throws the appropriate exception in either case or both, it is then redundant and unnecessary for buffer to check the same conditions.

        Specified by:
        buffer in class ByteBufferInputStream
        Throws:
        IOException