Class InputStreamContainer

    • Method Detail

      • openContainer

        final boolean openContainer​(ContainerKey newIdentity)
                             throws StandardException
        Description copied from class: FileContainer
        Open a container.

        Longer descrption of routine.

        Open a container. Open the file that maps to this container, if the file does not exist then we assume the container was never created. If the file exists but we have trouble opening it then we throw some exception.
        MT - single thread required - Enforced by cache manager.

        Specified by:
        openContainer in class FileContainer
        Throws:
        StandardException - Standard exception policy.
      • preAllocate

        protected final int preAllocate​(long lastPreallocPagenum,
                                        int preAllocSize)
        Preallocate page.
        Specified by:
        preAllocate in class FileContainer
        Parameters:
        lastPreallocPagenum - the last preallocated page number as known by the allocation page
        preAllocSize - try to preallocate this page number of pages. Since only the container knows how many pages are actually on disk, it may determine that certain number of pages that the allocation page thinks need to be preallocated is already allocated, in those case, act as if the preallocation is successful.
        Returns:
        number of successfully preallocated page, or 0 if no page has been preallocated
      • readPage

        protected final void readPage​(long pageNumber,
                                      byte[] pageData)
                               throws java.io.IOException,
                                      StandardException
        Read a page into the supplied array.
        MT - thread safe
        Specified by:
        readPage in class FileContainer
        Throws:
        java.io.IOException - error reading page
        StandardException - standard Derby error message
      • readPositionedPage

        protected void readPositionedPage​(long pageOffset,
                                          byte[] pageData)
                                   throws java.io.IOException
        Read the page at the positioned offset. This default implementation, opens the stream and skips to the offset and then reads the data into pageData.
        Throws:
        java.io.IOException
      • writePage

        protected final void writePage​(long pageNumber,
                                       byte[] pageData,
                                       boolean syncPage)
                                throws java.io.IOException,
                                       StandardException
        Write a page from the supplied array.
        MT - thread safe
        Specified by:
        writePage in class FileContainer
        Throws:
        java.io.IOException - error writing page
        StandardException - Standard Derby error policy
      • flushAll

        protected final void flushAll()
        Description copied from class: BaseContainer
        Flush all outstanding changes in this container to persistent storage.
        Specified by:
        flushAll in class BaseContainer
      • getInputStream

        protected java.io.InputStream getInputStream()
                                              throws java.io.IOException
        Get an input stream positioned at the beginning of the file
        Throws:
        java.io.IOException
      • backupContainer

        protected void backupContainer​(BaseContainerHandle handle,
                                       java.lang.String backupLocation)
                                throws StandardException
        Backup the container. There is no support to backup this type of containers. It may not be any real use for users because users can simply make copies of the read only database in Zip files easily using OS utilities.
        Specified by:
        backupContainer in class FileContainer
        Parameters:
        handle - the container handle.
        backupLocation - location of the backup container.
        Throws:
        StandardException - Standard Derby error policy
      • encryptOrDecryptContainer

        protected void encryptOrDecryptContainer​(BaseContainerHandle handle,
                                                 java.lang.String newFilePath,
                                                 boolean doEncrypt)
                                          throws StandardException
        Encrypts or decrypts the container.

        These operations are unsupported for this type of container.

        Specified by:
        encryptOrDecryptContainer in class BaseContainer
        Parameters:
        handle - the container handle
        newFilePath - file to store the new version of the container
        doEncrypt - tells whether to encrypt or decrypt
        Throws:
        StandardException - STORE_FEATURE_NOT_IMPLEMENTED