public class TarStreamBuilder extends AbstractArchiveBuilder<TarStreamBuilder,TarEntrySettings>
TarBuilder
.TarBuilder
,
TarFile
Constructor and Description |
---|
TarStreamBuilder(OutputStream os,
TarBuilderSettings settings)
Create a new Tar archive builder on an already open
OutputStream object. |
TarStreamBuilder(org.entityfs.WritableFile f)
Create a Tar builder using the default settings.
|
TarStreamBuilder(org.entityfs.WritableFile f,
TarBuilderSettings settings)
Create a Tar builder using the supplied settings.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addDirectoryCallback(org.entityfs.el.AbsoluteLocation location,
Object d,
TarEntrySettings effectiveSettings,
Date lastModified)
This callback method is implemented by subclasses to add a directory
entry to the archive.
|
protected void |
addFileCallback(org.entityfs.el.AbsoluteLocation location,
org.entityfs.ReadableFile f,
TarEntrySettings effectiveSettings,
Date lastModified)
This callback method is implemented by subclasses to add a file entry to
the archive.
|
protected void |
assertNotClosed()
Subclasses implement this method to throw an
IllegalStateException if it is called after the archive builder
has been closed. |
void |
close()
This method finishes writing the Tar file and closes it.
|
protected void |
finalize() |
protected TarEntrySettings |
getDefaultDefaultDirectoryEntrySettings()
Subclasses implement this method to return a default settings object for
directory entries if the client does not specify one when creating the
archive builder object.
|
protected TarEntrySettings |
getDefaultDefaultFileEntrySettings()
Subclasses implement this method to return a default settings object for
file entries if the client does not specify one when creating the archive
builder object.
|
boolean |
isClosed()
Is this archive builder closed?
|
add, add, add, add, add, add, add, add, add, addRecursively, addRecursively, addRecursively, addRecursively, addRecursively, addRule, addRules, getDefaultDirectoryEntrySettings, getDefaultFileEntrySettings, getEffectiveSettingsForDirectory, getEffectiveSettingsForDirectory, getEffectiveSettingsForFile, getEffectiveSettingsForFile, getRules, getThis, removeRule, setDefaultDirectoryEntrySettings, setDefaultFileEntrySettings
public TarStreamBuilder(org.entityfs.WritableFile f) throws org.entityfs.support.exception.WrappedIOException
TarBuilderSettings
.)f
- The file to write the archive to. The previous contents of this
file is discarded. If this method completes successfully, the target file
is locked for writing until close()
is called.org.entityfs.support.exception.WrappedIOException
- On I/O errors.TarStreamBuilder(WritableFile, TarBuilderSettings)
,
TarStreamBuilder(OutputStream, TarBuilderSettings)
public TarStreamBuilder(org.entityfs.WritableFile f, TarBuilderSettings settings) throws org.entityfs.support.exception.WrappedIOException
f
- The file to write the archive to. The previous contents of this
file is discarded. If this method completes successfully, the target file
is locked for writing until close()
is called.settings
- The settings for the builder. Set this to null
to
use the default settings.org.entityfs.support.exception.WrappedIOException
- On I/O errors.TarStreamBuilder(WritableFile)
,
TarStreamBuilder(OutputStream, TarBuilderSettings)
public TarStreamBuilder(OutputStream os, TarBuilderSettings settings) throws org.entityfs.support.exception.WrappedIOException
OutputStream
object. It will use the supplied settings
object.os
- The output stream to write data to. This stream is not
closed when close()
is called. The Tar builder assumes that it
has exclusive access to this OutputStream
.settings
- The settings for the builder. Set this to null
to
use the default settings.org.entityfs.support.exception.WrappedIOException
- On I/O errors.TarStreamBuilder(WritableFile, TarBuilderSettings)
protected TarEntrySettings getDefaultDefaultDirectoryEntrySettings()
AbstractArchiveBuilder
getDefaultDefaultDirectoryEntrySettings
in class AbstractArchiveBuilder<TarStreamBuilder,TarEntrySettings>
protected TarEntrySettings getDefaultDefaultFileEntrySettings()
AbstractArchiveBuilder
getDefaultDefaultFileEntrySettings
in class AbstractArchiveBuilder<TarStreamBuilder,TarEntrySettings>
protected void assertNotClosed() throws IllegalStateException
AbstractArchiveBuilder
IllegalStateException
if it is called after the archive builder
has been closed.assertNotClosed
in class AbstractArchiveBuilder<TarStreamBuilder,TarEntrySettings>
IllegalStateException
- If the archive builder has been closed.protected void addDirectoryCallback(org.entityfs.el.AbsoluteLocation location, Object d, TarEntrySettings effectiveSettings, Date lastModified) throws org.entityfs.support.exception.WrappedIOException, ArchiveEntryAddException
AbstractArchiveBuilder
Note: If this method throws an exception, it is the method's responsibility to make sure that the archive file is left in a consistent state. This should probably always mean that the failed entry is truncated from the archive file and that the current archive file pointer is restored to where it was before the method was called.
addDirectoryCallback
in class AbstractArchiveBuilder<TarStreamBuilder,TarEntrySettings>
location
- The location of the entry in the archive.d
- The directory. This may be a DirectoryView
or a File
.effectiveSettings
- The effective settings for the entry.lastModified
- The time when the directory was last modified.org.entityfs.support.exception.WrappedIOException
- On I/O errors.ArchiveEntryAddException
- If the entry could not be added to the
archive for some other reason than an I/O error.protected void addFileCallback(org.entityfs.el.AbsoluteLocation location, org.entityfs.ReadableFile f, TarEntrySettings effectiveSettings, Date lastModified) throws org.entityfs.support.exception.WrappedIOException, ArchiveEntryAddException
AbstractArchiveBuilder
Note: If this method throws an exception, it is the method's responsibility to make sure that the archive file is left in a consistent state. This should probably always mean that the failed entry is truncated from the archive file and that the current archive file pointer is restored to where it was before the method was called.
addFileCallback
in class AbstractArchiveBuilder<TarStreamBuilder,TarEntrySettings>
location
- The location of the entry in the archive.f
- The file.effectiveSettings
- The effective settings for the entry.lastModified
- The time when the file was last modified.org.entityfs.support.exception.WrappedIOException
- On I/O errors.ArchiveEntryAddException
- If the entry could not be added to the
archive for some other reason than an I/O error.public boolean isClosed()
ArchiveBuilder
true
if this archive builder is closed.public void close() throws org.entityfs.support.exception.WrappedIOException
FileSystem
.org.entityfs.support.exception.WrappedIOException
- On I/O errors.