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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description RAOutputStream
createOutputStream(java.lang.String relativePath)
RAOutputStream
createRandomAccessStream(java.lang.String relativePath)
Create a random access stream in the archive and return it.boolean
dropStream(java.lang.String relativePath)
Delete a stream from the archive.boolean
exists(java.lang.String relativePath)
void
finish()
This function must be called after the writer is used.void
flush()
This function flushs all the buffers in the writerIArchiveFile
getArchiveFile()
Get archive fileRAInputStream
getInputStream(java.lang.String relativePath)
java.lang.String
getName()
RAOutputStream
getOutputStream(java.lang.String relativePath)
void
initialize()
This function must be called before the writer is used.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 streamRAOutputStream
openRandomAccessStream(java.lang.String relativePath)
void
setStreamSorter(IStreamSorter streamSorter)
Set the stream sorter (if needed).void
unlock(java.lang.Object locker)
unlock the stream locked by the object.
-
-
-
Method Detail
-
initialize
void initialize() throws java.io.IOException
This function must be called before the writer is used. initialize the document archive.- Throws:
java.io.IOException
-
getName
java.lang.String getName()
- Returns:
- the archive name
-
createRandomAccessStream
RAOutputStream createRandomAccessStream(java.lang.String relativePath) throws java.io.IOException
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:
java.io.IOException
-
openRandomAccessStream
RAOutputStream openRandomAccessStream(java.lang.String relativePath) throws java.io.IOException
- Throws:
java.io.IOException
-
createOutputStream
RAOutputStream createOutputStream(java.lang.String relativePath) throws java.io.IOException
- Throws:
java.io.IOException
-
getOutputStream
RAOutputStream getOutputStream(java.lang.String relativePath) throws java.io.IOException
- Throws:
java.io.IOException
-
getInputStream
RAInputStream getInputStream(java.lang.String relativePath) throws java.io.IOException
- Throws:
java.io.IOException
-
dropStream
boolean dropStream(java.lang.String relativePath)
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:
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.- Returns:
- a list of strings representing the underlying stream names. The return values are in the relative path format too.
-
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
-
setStreamSorter
void setStreamSorter(IStreamSorter streamSorter)
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
void finish() throws java.io.IOException
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:
java.io.IOException
-
flush
void flush() throws java.io.IOException
This function flushs all the buffers in the writer- 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
-
getArchiveFile
IArchiveFile getArchiveFile()
Get archive file- Returns:
-
-