org.at4j.tar.builder
Interface TarEntryStrategy

All Known Implementing Classes:
GnuTarEntryStrategy, PaxTarEntryStrategy, UstarEntryStrategy, V7TarEntryStrategy

public interface TarEntryStrategy

This interface defines a strategy for how Tar entries are written to a tar file. Different implementations of this interface create Tar files formatted in different ways.

Implementations of this interface is used by the TarBuilder.

Since:
1.0
Author:
Karl Gustafsson
See Also:
TarBuilder

Method Summary
 void writeDirectory(DataSink out, DirectoryAdapter<?> d, AbsoluteLocation location, TarEntrySettings effectiveSettings, Date lastModified)
          Write a directory entry to the Tar file.
 void writeFile(DataSink out, ReadableFile f, AbsoluteLocation location, TarEntrySettings effectiveSettings, Date lastModified)
          Write a file entry to the Tar file.
 void writeFileFromStream(RandomAccess out, InputStream is, AbsoluteLocation location, TarEntrySettings effectiveSettings, Date lastModified)
          Write a file entry containing all data that can be read from the stream to the Tar file.
 

Method Detail

writeFile

void writeFile(DataSink out,
               ReadableFile f,
               AbsoluteLocation location,
               TarEntrySettings effectiveSettings,
               Date lastModified)
               throws WrappedIOException,
                      ArchiveEntryAddException
Write a file entry to the Tar file.

Parameters:
out - The DataSink to write to. This may be a RandomAccess object. When this method is called, the DataSink is positioned at the start of the entry to write. If this method returns successfully, the DataSink should be positioned at the next block boundary after the written entry (the Tar file is divided into 512-byte blocks).
f - The file to add to the archive. If this file is in a locking FileSystem, it is locked for reading by the caller before this method is called.
location - The absolute location of the entry in the Tar archive.
effectiveSettings - The effective settings for the entry.
lastModified - The time when the file entity was last modified.
Throws:
WrappedIOException - On I/O errors.
ArchiveEntryAddException - If the file entry cannot be added for some other reason than an I/O error.

writeFileFromStream

void writeFileFromStream(RandomAccess out,
                         InputStream is,
                         AbsoluteLocation location,
                         TarEntrySettings effectiveSettings,
                         Date lastModified)
                         throws WrappedIOException,
                                ArchiveEntryAddException
Write a file entry containing all data that can be read from the stream to the Tar file.

Parameters:
out - The RandomAccess to write to. When this method is called, the RandomAccess is positioned at the start of the entry to write. If this method returns successfully, the RandomAccess should be positioned at the next block boundary after the written entry (the Tar file is divided into 512-byte blocks).
is - The stream containing the file's data.
location - The absolute location of the entry in the Tar archive.
effectiveSettings - The effective settings for the entry.
lastModified - The time when the file entity was last modified.
Throws:
WrappedIOException - On I/O errors.
ArchiveEntryAddException - If the file entry cannot be added for some other reason than an I/O error.

writeDirectory

void writeDirectory(DataSink out,
                    DirectoryAdapter<?> d,
                    AbsoluteLocation location,
                    TarEntrySettings effectiveSettings,
                    Date lastModified)
                    throws WrappedIOException,
                           ArchiveEntryAddException
Write a directory entry to the Tar file.

Parameters:
out - The DataSink to write to. This may be a RandomAccess object. When this method is called, the DataSink is positioned at the start of the entry to write. If this method returns successfully, the DataSink should be positioned at the next block boundary after the written entry (the Tar file is divided into 512-byte blocks).
d - The directory to add to the Tar file.
location - The absolute location of the entry in the Tar archive.
effectiveSettings - The effective settings for the entry.
lastModified - The time when the directory entity was last modified.
Throws:
WrappedIOException - On I/O errors.
ArchiveEntryAddException - If the directory entry cannot be added for some other reason than an I/O error.