Class ArchiveWriter
- java.lang.Object
-
- org.eclipse.birt.core.archive.compound.ArchiveWriter
-
- All Implemented Interfaces:
IDocArchiveWriter
- Direct Known Subclasses:
FileArchiveWriter
public class ArchiveWriter extends java.lang.Object implements IDocArchiveWriter
-
-
Constructor Summary
Constructors Constructor Description ArchiveWriter(java.lang.String archiveName)ArchiveWriter(IArchiveFile archive)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description RAOutputStreamcreateOutputStream(java.lang.String relativePath)RAOutputStreamcreateRandomAccessStream(java.lang.String relativePath)Create a random access stream in the archive and return it.booleandropStream(java.lang.String relativePath)Delete a stream from the archive.booleanexists(java.lang.String relativePath)voidfinish()This function must be called after the writer is used.voidflush()This function flushs all the buffers in the writerIArchiveFilegetArchive()Deprecated.use getArchiveFile insteadIArchiveFilegetArchiveFile()Get archive fileRAInputStreamgetInputStream(java.lang.String relativePath)java.lang.StringgetName()RAOutputStreamgetOutputStream(java.lang.String relativePath)voidinitialize()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 namePattern)java.lang.Objectlock(java.lang.String relativePath)try to lock the streamRAOutputStreamopenRandomAccessStream(java.lang.String relativePath)voidsetStreamSorter(IStreamSorter streamSorter)Set the stream sorter (if needed).voidunlock(java.lang.Object locker)unlock the stream locked by the object.
-
-
-
Constructor Detail
-
ArchiveWriter
public ArchiveWriter(java.lang.String archiveName) throws java.io.IOException- Throws:
java.io.IOException
-
ArchiveWriter
public ArchiveWriter(IArchiveFile archive) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getArchive
@Deprecated public IArchiveFile getArchive()
Deprecated.use getArchiveFile instead- Returns:
-
getArchiveFile
public IArchiveFile getArchiveFile()
Description copied from interface:IDocArchiveWriterGet archive file- Specified by:
getArchiveFilein interfaceIDocArchiveWriter- Returns:
-
createRandomAccessStream
public RAOutputStream createRandomAccessStream(java.lang.String relativePath) throws java.io.IOException
Description copied from interface:IDocArchiveWriterCreate a random access stream in the archive and return it.- Specified by:
createRandomAccessStreamin 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:
java.io.IOException
-
openRandomAccessStream
public RAOutputStream openRandomAccessStream(java.lang.String relativePath) throws java.io.IOException
- Specified by:
openRandomAccessStreamin interfaceIDocArchiveWriter- Throws:
java.io.IOException
-
createOutputStream
public RAOutputStream createOutputStream(java.lang.String relativePath) throws java.io.IOException
- Specified by:
createOutputStreamin interfaceIDocArchiveWriter- Throws:
java.io.IOException
-
getOutputStream
public RAOutputStream getOutputStream(java.lang.String relativePath) throws java.io.IOException
- Specified by:
getOutputStreamin interfaceIDocArchiveWriter- Throws:
java.io.IOException
-
getInputStream
public RAInputStream getInputStream(java.lang.String relativePath) throws java.io.IOException
- Specified by:
getInputStreamin interfaceIDocArchiveWriter- Throws:
java.io.IOException
-
dropStream
public boolean dropStream(java.lang.String relativePath)
Description copied from interface:IDocArchiveWriterDelete a stream from the archive. Note: Not all of the derived classes support this function. E.g. FileArchiveWriter doesn't support it.- Specified by:
dropStreamin interfaceIDocArchiveWriter- Parameters:
relativePath- - the relative path of the stream- Returns:
- whether the operation was successful
-
exists
public boolean exists(java.lang.String relativePath)
- Specified by:
existsin 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
public void finish() throws java.io.IOExceptionDescription copied from interface:IDocArchiveWriterThis 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:
finishin interfaceIDocArchiveWriter- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOExceptionDescription copied from interface:IDocArchiveWriterThis function flushs all the buffers in the writer- Specified by:
flushin interfaceIDocArchiveWriter- Throws:
java.io.IOException
-
getName
public java.lang.String getName()
- Specified by:
getNamein interfaceIDocArchiveWriter- Returns:
- the archive name
-
initialize
public void initialize() throws java.io.IOExceptionDescription copied from interface:IDocArchiveWriterThis function must be called before the writer is used. initialize the document archive.- Specified by:
initializein interfaceIDocArchiveWriter- Throws:
java.io.IOException
-
setStreamSorter
public void setStreamSorter(IStreamSorter streamSorter)
Description copied from interface:IDocArchiveWriterSet 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:
setStreamSorterin interfaceIDocArchiveWriter- Parameters:
streamSorter- - the stream sorter
-
lock
public java.lang.Object lock(java.lang.String relativePath) throws java.io.IOExceptionDescription copied from interface:IDocArchiveWritertry to lock the stream- Specified by:
lockin interfaceIDocArchiveWriter- Returns:
- the locker.
- Throws:
java.io.IOException
-
unlock
public void unlock(java.lang.Object locker)
Description copied from interface:IDocArchiveWriterunlock the stream locked by the object.- Specified by:
unlockin interfaceIDocArchiveWriter- Parameters:
locker- object returned by the lock().
-
listAllStreams
public java.util.List<java.lang.String> listAllStreams() throws java.io.IOExceptionDescription copied from interface:IDocArchiveWriterget all the stream in the archive file.- Specified by:
listAllStreamsin interfaceIDocArchiveWriter- Returns:
- Throws:
java.io.IOException
-
listStreams
public java.util.List<java.lang.String> listStreams(java.lang.String namePattern) throws java.io.IOException- Specified by:
listStreamsin 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:
java.io.IOException
-
-