|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.at4j.archive.builder.AbstractArchiveBuilder<TarStreamBuilder,TarEntrySettings>
org.at4j.tar.builder.TarStreamBuilder
public class TarStreamBuilder
This Tar builder writes its output to a stream. Apart from that, and that
data from streams cannot be added to it, it works just like the other
TarBuilder
.
TarBuilder
,
TarFile
Constructor Summary | |
---|---|
TarStreamBuilder(OutputStream os,
TarBuilderSettings settings)
Create a new Tar archive builder on an already open OutputStream object. |
|
TarStreamBuilder(WritableFile f)
Create a Tar builder using the default settings. |
|
TarStreamBuilder(WritableFile f,
TarBuilderSettings settings)
Create a Tar builder using the supplied settings. |
Method Summary | |
---|---|
protected void |
addDirectoryCallback(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(AbsoluteLocation location,
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? |
Methods inherited from class org.at4j.archive.builder.AbstractArchiveBuilder |
---|
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TarStreamBuilder(WritableFile f) throws 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.
WrappedIOException
- On I/O errors.TarStreamBuilder(WritableFile, TarBuilderSettings)
,
TarStreamBuilder(OutputStream, TarBuilderSettings)
public TarStreamBuilder(WritableFile f, TarBuilderSettings settings) throws 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.
WrappedIOException
- On I/O errors.TarStreamBuilder(WritableFile)
,
TarStreamBuilder(OutputStream, TarBuilderSettings)
public TarStreamBuilder(OutputStream os, TarBuilderSettings settings) throws 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.
WrappedIOException
- On I/O errors.TarStreamBuilder(WritableFile, TarBuilderSettings)
Method Detail |
---|
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(AbsoluteLocation location, Object d, TarEntrySettings effectiveSettings, Date lastModified) throws 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.
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(AbsoluteLocation location, ReadableFile f, TarEntrySettings effectiveSettings, Date lastModified) throws 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.
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 WrappedIOException
FileSystem
.
WrappedIOException
- On I/O errors.protected void finalize() throws Throwable
finalize
in class Object
Throwable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |