Package org.eclipse.birt.core.archive
Interface IDocArchiveWriter
- All Known Implementing Classes:
ArchiveWriter
,FileArchiveWriter
,FolderArchive
,FolderArchiveWriter
public interface IDocArchiveWriter
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.
-
Method Summary
Modifier and TypeMethodDescriptioncreateOutputStream
(String relativePath) createRandomAccessStream
(String relativePath) Create a random access stream in the archive and return it.boolean
dropStream
(String relativePath) Delete a stream from the archive.boolean
void
finish()
This function must be called after the writer is used.void
flush()
This function flushs all the buffers in the writerGet archive filegetInputStream
(String relativePath) getName()
getOutputStream
(String relativePath) void
This function must be called before the writer is used.get all the stream in the archive file.listStreams
(String relativeStoragePath) try to lock the streamopenRandomAccessStream
(String relativePath) void
setStreamSorter
(IStreamSorter streamSorter) Set the stream sorter (if needed).void
unlock the stream locked by the object.
-
Method Details
-
initialize
This function must be called before the writer is used. initialize the document archive.- Throws:
IOException
-
getName
String getName()- Returns:
- the archive name
-
createRandomAccessStream
Create a random access stream in the archive and return it.- Parameters:
relativePath
- - relative path to report archive path. The path is based on Unix syntax, with the root of the archive denoted by "/". The initial "/" character can be skipped.- Returns:
- RAOutputStream
- Throws:
IOException
-
openRandomAccessStream
- Throws:
IOException
-
createOutputStream
- Throws:
IOException
-
getOutputStream
- Throws:
IOException
-
getInputStream
- Throws:
IOException
-
dropStream
Delete a stream from the archive. Note: Not all of the derived classes support this function. E.g. FileArchiveWriter doesn't support it.- Parameters:
relativePath
- - the relative path of the stream- Returns:
- whether the operation was successful
- Throws:
IOException
-
exists
- 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.- Returns:
- a list of strings representing the underlying stream names. The return values are in the relative path format too.
-
listStreams
- 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
get all the stream in the archive file.- Returns:
- Throws:
IOException
-
setStreamSorter
Set the stream sorter (if needed). The stream sorter will be used to sort the streams. If no stream sorter is set, the streams will be written in random order.- Parameters:
streamSorter
- - the stream sorter
-
finish
This function must be called after the writer is used. finalizes the socument archive. This may involve compressing the archive to a single file. This also closes and finishes using the archive.- Throws:
IOException
-
flush
This function flushs all the buffers in the writer- Throws:
IOException
-
lock
try to lock the stream- Parameters:
stream
-- Returns:
- the locker.
- Throws:
IOException
-
unlock
unlock the stream locked by the object.- Parameters:
locker
- object returned by the lock().- Throws:
IOException
-
getArchiveFile
IArchiveFile getArchiveFile()Get archive file- Returns:
-