Interface IDocArchiveReader

  • All Known Implementing Classes:
    ArchiveReader, FileArchiveReader, FolderArchive, FolderArchiveReader

    public interface IDocArchiveReader
    An interface that wraps around a report archive for reading. A report archive may be, but is not limited to a zip file in compressed format, a folder in uncompressed format. Notice that the interface does not define archive file name, nor does it define folder name to store/uncompress the archive to. Setting such environments up is implementation class's responsibility. To external users of IReportArchive, it only cares what he can retrieve from the archive.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void close()
      This function must be called after the reader is used.
      boolean exists​(java.lang.String relativePath)  
      RAInputStream getInputStream​(java.lang.String relativePath)  
      java.lang.String getName()  
      RAInputStream getStream​(java.lang.String relativePath)
      returns a sequential access file.
      java.util.List<java.lang.String> listAllStreams()
      get all the stream in the archive file.
      java.util.List<java.lang.String> listStreams​(java.lang.String relativeStoragePath)  
      java.lang.Object lock​(java.lang.String stream)
      try to lock the stream
      void open()
      This functiona must be called before the reader is used.
      void unlock​(java.lang.Object locker)
      unlock the stream locked by the object.
    • Method Detail

      • getName

        java.lang.String getName()
        Returns:
        the archive name
      • open

        void open()
           throws java.io.IOException
        This functiona must be called before the reader is used. initialize the document archive. For example, the index stream mey be read into memory.
        Throws:
        java.io.IOException
      • getStream

        RAInputStream getStream​(java.lang.String relativePath)
                         throws java.io.IOException
        returns a sequential access file.
        Parameters:
        relativePath - - the relative stream path in the archive. The relative path is based on Unix syntax, with the root of the archive denoted by "/". The initial "/" character can be skipped. Used mainly for sequential streams in report.
        Returns:
        RAInputStream
        Throws:
        java.io.IOException
      • getInputStream

        RAInputStream getInputStream​(java.lang.String relativePath)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • exists

        boolean exists​(java.lang.String relativePath)
        Parameters:
        relativePath - - the relative stream path in the archive. The relative path is based on Unix syntax, with the root of the archive denoted by "/". The initial "/" character can be skipped. Used mainly for sequential streams in report.
        Returns:
        whether the stream exist
      • listStreams

        java.util.List<java.lang.String> listStreams​(java.lang.String relativeStoragePath)
                                              throws java.io.IOException
        Parameters:
        relativeStoragePath - - the relative stream path in the archive. The relative path is based on Unix syntax, with the root of the archive denoted by "/". The initial "/" character can be skipped.
        Returns:
        a list of strings representing the underlying stream names. The return values are in the relative path format too.
        Throws:
        java.io.IOException
      • listAllStreams

        java.util.List<java.lang.String> listAllStreams()
                                                 throws java.io.IOException
        get all the stream in the archive file.
        Returns:
        Throws:
        java.io.IOException
      • close

        void close()
            throws java.io.IOException
        This function must be called after the reader is used. close the archive.
        Throws:
        java.io.IOException
      • lock

        java.lang.Object lock​(java.lang.String stream)
                       throws java.io.IOException
        try to lock the stream
        Parameters:
        stream -
        Returns:
        the locker.
        Throws:
        java.io.IOException
      • unlock

        void unlock​(java.lang.Object locker)
        unlock the stream locked by the object.
        Parameters:
        locker - object returned by the lock().
        Throws:
        java.io.IOException