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 Details

    • getName

      String getName()
      Returns:
      the archive name
    • open

      void open() throws 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:
      IOException
    • getStream

      RAInputStream getStream(String relativePath) throws 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:
      IOException
    • getInputStream

      RAInputStream getInputStream(String relativePath) throws IOException
      Throws:
      IOException
    • exists

      boolean exists(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

      List<String> listStreams(String relativeStoragePath) throws 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:
      IOException
    • listAllStreams

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

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

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

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