Class ArchiveReader
- java.lang.Object
-
- org.eclipse.birt.core.archive.compound.ArchiveReader
-
- All Implemented Interfaces:
IDocArchiveReader
- Direct Known Subclasses:
FileArchiveReader
public class ArchiveReader extends java.lang.Object implements IDocArchiveReader
-
-
Field Summary
Fields Modifier and Type Field Description protected IArchiveFile
archive
protected boolean
shareArchive
-
Constructor Summary
Constructors Constructor Description ArchiveReader(java.lang.String archiveName)
ArchiveReader(IArchiveFile archive)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
This function must be called after the reader is used.boolean
exists(java.lang.String relativePath)
IArchiveFile
getArchive()
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 namePattern)
java.lang.Object
lock(java.lang.String relativePath)
try to lock the streamvoid
open()
This functiona must be called before the reader is used.void
unlock(java.lang.Object locker)
unlock the stream locked by the object.
-
-
-
Field Detail
-
archive
protected IArchiveFile archive
-
shareArchive
protected boolean shareArchive
-
-
Constructor Detail
-
ArchiveReader
public ArchiveReader(IArchiveFile archive) throws java.io.IOException
- Throws:
java.io.IOException
-
ArchiveReader
public ArchiveReader(java.lang.String archiveName) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
close
public void close() throws java.io.IOException
Description copied from interface:IDocArchiveReader
This function must be called after the reader is used. close the archive.- Specified by:
close
in interfaceIDocArchiveReader
- Throws:
java.io.IOException
-
getArchive
public IArchiveFile getArchive()
-
exists
public boolean exists(java.lang.String relativePath)
- Specified by:
exists
in interfaceIDocArchiveReader
- 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
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfaceIDocArchiveReader
- Returns:
- the archive name
-
getStream
public RAInputStream getStream(java.lang.String relativePath) throws java.io.IOException
Description copied from interface:IDocArchiveReader
returns a sequential access file.- Specified by:
getStream
in interfaceIDocArchiveReader
- 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
public RAInputStream getInputStream(java.lang.String relativePath) throws java.io.IOException
- Specified by:
getInputStream
in interfaceIDocArchiveReader
- Throws:
java.io.IOException
-
listAllStreams
public java.util.List<java.lang.String> listAllStreams() throws java.io.IOException
Description copied from interface:IDocArchiveReader
get all the stream in the archive file.- Specified by:
listAllStreams
in interfaceIDocArchiveReader
- Returns:
- Throws:
java.io.IOException
-
listStreams
public java.util.List<java.lang.String> listStreams(java.lang.String namePattern) throws java.io.IOException
- Specified by:
listStreams
in interfaceIDocArchiveReader
- Parameters:
namePattern
- - 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
-
open
public void open() throws java.io.IOException
Description copied from interface:IDocArchiveReader
This functiona must be called before the reader is used. initialize the document archive. For example, the index stream mey be read into memory.- Specified by:
open
in interfaceIDocArchiveReader
- Throws:
java.io.IOException
-
lock
public java.lang.Object lock(java.lang.String relativePath) throws java.io.IOException
Description copied from interface:IDocArchiveReader
try to lock the stream- Specified by:
lock
in interfaceIDocArchiveReader
- Returns:
- the locker.
- Throws:
java.io.IOException
-
unlock
public void unlock(java.lang.Object locker)
Description copied from interface:IDocArchiveReader
unlock the stream locked by the object.- Specified by:
unlock
in interfaceIDocArchiveReader
- Parameters:
locker
- object returned by the lock().
-
-