Class ArchiveWriter
java.lang.Object
org.eclipse.birt.core.archive.compound.ArchiveWriter
- All Implemented Interfaces:
IDocArchiveWriter
- Direct Known Subclasses:
FileArchiveWriter
-
Constructor Summary
Constructors -
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 writerDeprecated.use getArchiveFile insteadGet 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 namePattern) 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.
-
Constructor Details
-
ArchiveWriter
- Throws:
IOException
-
ArchiveWriter
- Throws:
IOException
-
-
Method Details
-
getArchive
Deprecated.use getArchiveFile instead- Returns:
-
getArchiveFile
Description copied from interface:IDocArchiveWriter
Get archive file- Specified by:
getArchiveFile
in interfaceIDocArchiveWriter
- Returns:
-
createRandomAccessStream
Description copied from interface:IDocArchiveWriter
Create a random access stream in the archive and return it.- Specified by:
createRandomAccessStream
in interfaceIDocArchiveWriter
- 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
- Specified by:
openRandomAccessStream
in interfaceIDocArchiveWriter
- Throws:
IOException
-
createOutputStream
- Specified by:
createOutputStream
in interfaceIDocArchiveWriter
- Throws:
IOException
-
getOutputStream
- Specified by:
getOutputStream
in interfaceIDocArchiveWriter
- Throws:
IOException
-
getInputStream
- Specified by:
getInputStream
in interfaceIDocArchiveWriter
- Throws:
IOException
-
dropStream
Description copied from interface:IDocArchiveWriter
Delete a stream from the archive. Note: Not all of the derived classes support this function. E.g. FileArchiveWriter doesn't support it.- Specified by:
dropStream
in interfaceIDocArchiveWriter
- Parameters:
relativePath
- - the relative path of the stream- Returns:
- whether the operation was successful
-
exists
- Specified by:
exists
in interfaceIDocArchiveWriter
- 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.
-
finish
Description copied from interface:IDocArchiveWriter
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.- Specified by:
finish
in interfaceIDocArchiveWriter
- Throws:
IOException
-
flush
Description copied from interface:IDocArchiveWriter
This function flushs all the buffers in the writer- Specified by:
flush
in interfaceIDocArchiveWriter
- Throws:
IOException
-
getName
- Specified by:
getName
in interfaceIDocArchiveWriter
- Returns:
- the archive name
-
initialize
Description copied from interface:IDocArchiveWriter
This function must be called before the writer is used. initialize the document archive.- Specified by:
initialize
in interfaceIDocArchiveWriter
- Throws:
IOException
-
setStreamSorter
Description copied from interface:IDocArchiveWriter
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.- Specified by:
setStreamSorter
in interfaceIDocArchiveWriter
- Parameters:
streamSorter
- - the stream sorter
-
lock
Description copied from interface:IDocArchiveWriter
try to lock the stream- Specified by:
lock
in interfaceIDocArchiveWriter
- Returns:
- the locker.
- Throws:
IOException
-
unlock
Description copied from interface:IDocArchiveWriter
unlock the stream locked by the object.- Specified by:
unlock
in interfaceIDocArchiveWriter
- Parameters:
locker
- object returned by the lock().
-
listAllStreams
Description copied from interface:IDocArchiveWriter
get all the stream in the archive file.- Specified by:
listAllStreams
in interfaceIDocArchiveWriter
- Returns:
- Throws:
IOException
-
listStreams
- Specified by:
listStreams
in interfaceIDocArchiveWriter
- 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:
IOException
-